Skip to content

Commit 0624351

Browse files
committed
f gate batching branch on v2 check
1 parent 00d973a commit 0624351

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2128,11 +2128,12 @@ trait InitialRemoteCommitmentReceiver<SP: Deref> where SP::Target: SignerProvide
21282128

21292129
// Now that we're past error-generating stuff, update our local state:
21302130

2131+
let is_v2_established = self.is_v2_established();
21312132
let context = self.context_mut();
21322133
context.channel_id = channel_id;
21332134

21342135
assert!(!context.channel_state.is_monitor_update_in_progress()); // We have not had any monitor(s) yet to fail update!
2135-
if !context.channel_state.is_interactive_signing() {
2136+
if !is_v2_established {
21362137
if context.is_batch_funding() {
21372138
context.channel_state = ChannelState::AwaitingChannelReady(AwaitingChannelReadyFlags::WAITING_FOR_BATCH);
21382139
} else {
@@ -2169,6 +2170,19 @@ trait InitialRemoteCommitmentReceiver<SP: Deref> where SP::Target: SignerProvide
21692170

21702171
Ok((channel_monitor, counterparty_initial_commitment_tx))
21712172
}
2173+
2174+
fn is_v2_established(&self) -> bool {
2175+
let channel_parameters = &self.funding().channel_transaction_parameters;
2176+
// This will return false if `counterparty_parameters` is `None`. This is possible if we sent `open_channel2`,
2177+
// but did not yet receive an `accept_channel2`.
2178+
if let Some(ref counterparty_parameters) = channel_parameters.counterparty_parameters {
2179+
self.context().channel_id().is_v2_channel_id(
2180+
&channel_parameters.holder_pubkeys.revocation_basepoint,
2181+
&counterparty_parameters.pubkeys.revocation_basepoint)
2182+
} else {
2183+
false
2184+
}
2185+
}
21722186
}
21732187

21742188
impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for OutboundV1Channel<SP> where SP::Target: SignerProvider {

0 commit comments

Comments
 (0)