Skip to content

Commit

Permalink
Handle sending accept_channel when signer is unblocked
Browse files Browse the repository at this point in the history
  • Loading branch information
alecchendev committed Jun 10, 2024
1 parent 0bdb607 commit 5590bc5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
14 changes: 14 additions & 0 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8053,6 +8053,20 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {

Ok((channel, funding_signed, channel_monitor))
}

/// Indicates that the signer may have some signatures for us, so we should retry if we're
/// blocked.
#[allow(unused)]
pub fn signer_maybe_unblocked<L: Deref>(&mut self, logger: &L) -> Option<msgs::AcceptChannel>
where L::Target: Logger
{
if !self.context.holder_commitment_point.is_available() {
self.context.holder_commitment_point.advance(&self.context.holder_signer, &self.context.secp_ctx, logger);
}
if self.signer_pending_accept_channel && self.context.holder_commitment_point.is_available() {
self.generate_accept_channel_message(logger)
} else { None }
}
}

// A not-yet-funded outbound (from holder) channel using V2 channel establishment.
Expand Down
12 changes: 10 additions & 2 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8146,9 +8146,17 @@ where
});
}
}
ChannelPhase::UnfundedInboundV1(_) => {},
ChannelPhase::UnfundedInboundV1(chan) => {
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
if let Some(msg) = chan.signer_maybe_unblocked(&&logger) {
pending_msg_events.push(events::MessageSendEvent::SendAcceptChannel {
node_id,
msg,
});
}
},
}
};
};

let per_peer_state = self.per_peer_state.read().unwrap();
if let Some((counterparty_node_id, channel_id)) = channel_opt {
Expand Down

0 comments on commit 5590bc5

Please sign in to comment.