Skip to content

Commit 721fc67

Browse files
committed
Handle sending open_channel when signer is unblocked
1 parent 7d86cde commit 721fc67

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

lightning/src/ln/channel.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7978,11 +7978,24 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
79787978
/// Indicates that the signer may have some signatures for us, so we should retry if we're
79797979
/// blocked.
79807980
#[cfg(async_signing)]
7981-
pub fn signer_maybe_unblocked<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
7982-
if self.context.signer_pending_funding && self.context.is_outbound() {
7983-
log_trace!(logger, "Signer unblocked a funding_created");
7981+
pub fn signer_maybe_unblocked<L: Deref>(&mut self, chain_hash: ChainHash, logger: &L) -> (Option<msgs::OpenChannel>, Option<msgs::FundingCreated>)
7982+
where L::Target: Logger
7983+
{
7984+
// If we were pending a commitment point, retry the signer and advance to an
7985+
// available state.
7986+
if !self.context.holder_commitment_point.is_available() {
7987+
self.context.holder_commitment_point.try_resolve_pending(&self.context.holder_signer, &self.context.secp_ctx, logger);
7988+
}
7989+
let open_channel = if self.signer_pending_open_channel && self.context.holder_commitment_point.is_available() {
7990+
log_trace!(logger, "Attempting to generate open_channel...");
7991+
self.get_open_channel(chain_hash, logger)
7992+
} else { None };
7993+
let funding_created = if self.context.signer_pending_funding && self.context.is_outbound() {
7994+
log_trace!(logger, "Attempting to generate pending funding created...");
7995+
self.context.signer_pending_funding = false;
79847996
self.get_funding_created_msg(logger)
7985-
} else { None }
7997+
} else { None };
7998+
(open_channel, funding_created)
79867999
}
79878000
}
79888001

lightning/src/ln/channelmanager.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8866,7 +8866,14 @@ where
88668866
msgs.shutdown_result
88678867
}
88688868
ChannelPhase::UnfundedOutboundV1(chan) => {
8869-
if let Some(msg) = chan.signer_maybe_unblocked(&self.logger) {
8869+
let (open_channel, funding_created) = chan.signer_maybe_unblocked(self.chain_hash.clone(), &self.logger);
8870+
if let Some(msg) = open_channel {
8871+
pending_msg_events.push(events::MessageSendEvent::SendOpenChannel {
8872+
node_id,
8873+
msg,
8874+
});
8875+
}
8876+
if let Some(msg) = funding_created {
88708877
pending_msg_events.push(events::MessageSendEvent::SendFundingCreated {
88718878
node_id,
88728879
msg,

0 commit comments

Comments
 (0)