Skip to content

Commit 8e45804

Browse files
committed
Handle sending accept_channel when signer is unblocked
1 parent b56c663 commit 8e45804

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8306,6 +8306,29 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
83068306

83078307
Ok((channel, funding_signed, channel_monitor))
83088308
}
8309+
8310+
/// Indicates that the signer may have some signatures for us, so we should retry if we're
8311+
/// blocked.
8312+
#[allow(unused)]
8313+
pub fn signer_maybe_unblocked<L: Deref>(&mut self, logger: &L) -> Option<msgs::AcceptChannel>
8314+
where L::Target: Logger
8315+
{
8316+
if self.unfunded_context.holder_commitment_point.is_none() {
8317+
self.unfunded_context.holder_commitment_point = HolderCommitmentPoint::new(&self.context.holder_signer, &self.context.secp_ctx);
8318+
}
8319+
if let Some(ref mut point) = self.unfunded_context.holder_commitment_point {
8320+
if !point.is_available() {
8321+
point.try_resolve_pending(&self.context.holder_signer, &self.context.secp_ctx, logger);
8322+
}
8323+
}
8324+
match self.unfunded_context.holder_commitment_point {
8325+
Some(ref mut point) if point.is_available() && self.signer_pending_accept_channel => {
8326+
log_trace!(logger, "Attempting to generate accept_channel...");
8327+
self.generate_accept_channel_message(logger)
8328+
}
8329+
_ => None
8330+
}
8331+
}
83098332
}
83108333

83118334
// A not-yet-funded outbound (from holder) channel using V2 channel establishment.

lightning/src/ln/channelmanager.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8887,7 +8887,16 @@ where
88878887
}
88888888
None
88898889
}
8890-
ChannelPhase::UnfundedInboundV1(_) => None,
8890+
ChannelPhase::UnfundedInboundV1(chan) => {
8891+
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8892+
if let Some(msg) = chan.signer_maybe_unblocked(&&logger) {
8893+
pending_msg_events.push(events::MessageSendEvent::SendAcceptChannel {
8894+
node_id,
8895+
msg,
8896+
});
8897+
}
8898+
None
8899+
},
88918900
}
88928901
};
88938902

0 commit comments

Comments
 (0)