Skip to content

Commit daf2aa6

Browse files
committed
Require option_static_remotekey in channel/channelmonitor.
This simplifies channelmonitor quite nicely (as expected) as we never have to be concerned with learning data in a DataLossProtect which is require for us to claim our funds from the latest remote commitment transaction.
1 parent b6c92e1 commit daf2aa6

10 files changed

+263
-341
lines changed

fuzz/src/full_stack.rs

+15-15
Large diffs are not rendered by default.

lightning/src/chain/keysinterface.rs

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ pub enum SpendableOutputDescriptor {
7474
/// The output which is referenced by the given outpoint
7575
output: TxOut,
7676
},
77+
// TODO: Note that because key is now static and exactly what is provided by us, we should drop
78+
// this in favor of StaticOutput:
7779
/// An output to a P2WPKH, spendable exclusively by the given private key.
7880
/// The witness in the spending input, is, thus, simply:
7981
/// <BIP 143 signature generated with the given key> <public key derived from the given key>

lightning/src/ln/chan_utils.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,9 @@ pub struct TxCreationKeys {
262262
pub(crate) b_htlc_key: PublicKey,
263263
/// A's Payment Key (which isn't allowed to be spent from for some delay)
264264
pub(crate) a_delayed_payment_key: PublicKey,
265-
/// B's Payment Key
266-
pub(crate) b_payment_key: PublicKey,
267265
}
268266
impl_writeable!(TxCreationKeys, 33*6,
269-
{ per_commitment_point, revocation_key, a_htlc_key, b_htlc_key, a_delayed_payment_key, b_payment_key });
267+
{ per_commitment_point, revocation_key, a_htlc_key, b_htlc_key, a_delayed_payment_key });
270268

271269
/// One counterparty's public keys which do not change over the life of a channel.
272270
#[derive(Clone, PartialEq)]
@@ -301,14 +299,13 @@ impl_writeable!(ChannelPublicKeys, 33*5, {
301299

302300

303301
impl TxCreationKeys {
304-
pub(crate) fn new<T: secp256k1::Signing + secp256k1::Verification>(secp_ctx: &Secp256k1<T>, per_commitment_point: &PublicKey, a_delayed_payment_base: &PublicKey, a_htlc_base: &PublicKey, b_revocation_base: &PublicKey, b_payment_base: &PublicKey, b_htlc_base: &PublicKey) -> Result<TxCreationKeys, secp256k1::Error> {
302+
pub(crate) fn new<T: secp256k1::Signing + secp256k1::Verification>(secp_ctx: &Secp256k1<T>, per_commitment_point: &PublicKey, a_delayed_payment_base: &PublicKey, a_htlc_base: &PublicKey, b_revocation_base: &PublicKey, b_htlc_base: &PublicKey) -> Result<TxCreationKeys, secp256k1::Error> {
305303
Ok(TxCreationKeys {
306304
per_commitment_point: per_commitment_point.clone(),
307305
revocation_key: derive_public_revocation_key(&secp_ctx, &per_commitment_point, &b_revocation_base)?,
308306
a_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &a_htlc_base)?,
309307
b_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &b_htlc_base)?,
310308
a_delayed_payment_key: derive_public_key(&secp_ctx, &per_commitment_point, &a_delayed_payment_base)?,
311-
b_payment_key: derive_public_key(&secp_ctx, &per_commitment_point, &b_payment_base)?,
312309
})
313310
}
314311
}
@@ -537,7 +534,6 @@ impl LocalCommitmentTransaction {
537534
a_htlc_key: dummy_key.clone(),
538535
b_htlc_key: dummy_key.clone(),
539536
a_delayed_payment_key: dummy_key.clone(),
540-
b_payment_key: dummy_key.clone(),
541537
},
542538
feerate_per_kw: 0,
543539
per_htlc: Vec::new()

lightning/src/ln/channel.rs

+209-219
Large diffs are not rendered by default.

lightning/src/ln/channelmanager.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl MsgHandleErrInternal {
252252
},
253253
},
254254
},
255-
ChannelError::CloseDelayBroadcast { msg, .. } => LightningError {
255+
ChannelError::CloseDelayBroadcast(msg) => LightningError {
256256
err: msg,
257257
action: msgs::ErrorAction::SendErrorMessage {
258258
msg: msgs::ErrorMessage {
@@ -575,8 +575,9 @@ macro_rules! break_chan_entry {
575575
if let Some(short_id) = chan.get_short_channel_id() {
576576
$channel_state.short_to_id.remove(&short_id);
577577
}
578-
break Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, chan.force_shutdown(true), $self.get_channel_update(&chan).ok())) },
579-
Err(ChannelError::CloseDelayBroadcast { .. }) => { panic!("Wait is only generated on receipt of channel_reestablish, which is handled by try_chan_entry, we don't bother to support it here"); }
578+
break Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, chan.force_shutdown(true), $self.get_channel_update(&chan).ok()))
579+
},
580+
Err(ChannelError::CloseDelayBroadcast(_)) => { panic!("Wait is only generated on receipt of channel_reestablish, which is handled by try_chan_entry, we don't bother to support it here"); }
580581
}
581582
}
582583
}
@@ -596,22 +597,12 @@ macro_rules! try_chan_entry {
596597
}
597598
return Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, chan.force_shutdown(true), $self.get_channel_update(&chan).ok()))
598599
},
599-
Err(ChannelError::CloseDelayBroadcast { msg, update }) => {
600+
Err(ChannelError::CloseDelayBroadcast(msg)) => {
600601
log_error!($self, "Channel {} need to be shutdown but closing transactions not broadcast due to {}", log_bytes!($entry.key()[..]), msg);
601602
let (channel_id, mut chan) = $entry.remove_entry();
602603
if let Some(short_id) = chan.get_short_channel_id() {
603604
$channel_state.short_to_id.remove(&short_id);
604605
}
605-
if let Err(e) = $self.monitor.update_monitor(chan.get_funding_txo().unwrap(), update) {
606-
match e {
607-
// Upstream channel is dead, but we want at least to fail backward HTLCs to save
608-
// downstream channels. In case of PermanentFailure, we are not going to be able
609-
// to claim back to_remote output on remote commitment transaction. Doesn't
610-
// make a difference here, we are concern about HTLCs circuit, not onchain funds.
611-
ChannelMonitorUpdateErr::PermanentFailure => {},
612-
ChannelMonitorUpdateErr::TemporaryFailure => {},
613-
}
614-
}
615606
let shutdown_res = chan.force_shutdown(false);
616607
return Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, shutdown_res, $self.get_channel_update(&chan).ok()))
617608
}
@@ -1665,7 +1656,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref> ChannelMan
16651656
}
16661657
Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, channel.force_shutdown(true), self.get_channel_update(&channel).ok()))
16671658
},
1668-
ChannelError::CloseDelayBroadcast { .. } => { panic!("Wait is only generated on receipt of channel_reestablish, which is handled by try_chan_entry, we don't bother to support it here"); }
1659+
ChannelError::CloseDelayBroadcast(_) => { panic!("Wait is only generated on receipt of channel_reestablish, which is handled by try_chan_entry, we don't bother to support it here"); }
16691660
};
16701661
handle_errors.push((their_node_id, err));
16711662
continue;

lightning/src/ln/channelmonitor.rs

+16-75
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,6 @@ pub(super) enum ChannelMonitorUpdateStep {
589589
idx: u64,
590590
secret: [u8; 32],
591591
},
592-
/// Indicates our channel is likely a stale version, we're closing, but this update should
593-
/// allow us to spend what is ours if our counterparty broadcasts their latest state.
594-
RescueRemoteCommitmentTXInfo {
595-
their_current_per_commitment_point: PublicKey,
596-
},
597592
/// Used to indicate that the no future updates will occur, and likely that the latest local
598593
/// commitment transaction(s) should be broadcast, as the channel has been force-closed.
599594
ChannelForceClosed {
@@ -636,12 +631,8 @@ impl Writeable for ChannelMonitorUpdateStep {
636631
idx.write(w)?;
637632
secret.write(w)?;
638633
},
639-
&ChannelMonitorUpdateStep::RescueRemoteCommitmentTXInfo { ref their_current_per_commitment_point } => {
640-
4u8.write(w)?;
641-
their_current_per_commitment_point.write(w)?;
642-
},
643634
&ChannelMonitorUpdateStep::ChannelForceClosed { ref should_broadcast } => {
644-
5u8.write(w)?;
635+
4u8.write(w)?;
645636
should_broadcast.write(w)?;
646637
},
647638
}
@@ -691,11 +682,6 @@ impl Readable for ChannelMonitorUpdateStep {
691682
})
692683
},
693684
4u8 => {
694-
Ok(ChannelMonitorUpdateStep::RescueRemoteCommitmentTXInfo {
695-
their_current_per_commitment_point: Readable::read(r)?,
696-
})
697-
},
698-
5u8 => {
699685
Ok(ChannelMonitorUpdateStep::ChannelForceClosed {
700686
should_broadcast: Readable::read(r)?
701687
})
@@ -721,7 +707,7 @@ pub struct ChannelMonitor<ChanSigner: ChannelKeys> {
721707

722708
destination_script: Script,
723709
broadcasted_local_revokable_script: Option<(Script, SecretKey, Script)>,
724-
broadcasted_remote_payment_script: Option<(Script, SecretKey)>,
710+
remote_payment_script: Script,
725711
shutdown_script: Script,
726712

727713
keys: ChanSigner,
@@ -817,7 +803,7 @@ impl<ChanSigner: ChannelKeys> PartialEq for ChannelMonitor<ChanSigner> {
817803
self.commitment_transaction_number_obscure_factor != other.commitment_transaction_number_obscure_factor ||
818804
self.destination_script != other.destination_script ||
819805
self.broadcasted_local_revokable_script != other.broadcasted_local_revokable_script ||
820-
self.broadcasted_remote_payment_script != other.broadcasted_remote_payment_script ||
806+
self.remote_payment_script != other.remote_payment_script ||
821807
self.keys.pubkeys() != other.keys.pubkeys() ||
822808
self.funding_info != other.funding_info ||
823809
self.current_remote_commitment_txid != other.current_remote_commitment_txid ||
@@ -881,13 +867,7 @@ impl<ChanSigner: ChannelKeys + Writeable> ChannelMonitor<ChanSigner> {
881867
writer.write_all(&[1; 1])?;
882868
}
883869

884-
if let Some(ref broadcasted_remote_payment_script) = self.broadcasted_remote_payment_script {
885-
writer.write_all(&[0; 1])?;
886-
broadcasted_remote_payment_script.0.write(writer)?;
887-
broadcasted_remote_payment_script.1.write(writer)?;
888-
} else {
889-
writer.write_all(&[1; 1])?;
890-
}
870+
self.remote_payment_script.write(writer)?;
891871
self.shutdown_script.write(writer)?;
892872

893873
self.keys.write(writer)?;
@@ -1062,6 +1042,8 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
10621042
assert!(commitment_transaction_number_obscure_factor <= (1 << 48));
10631043
let our_channel_close_key_hash = WPubkeyHash::hash(&shutdown_pubkey.serialize());
10641044
let shutdown_script = Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&our_channel_close_key_hash[..]).into_script();
1045+
let payment_base_key_hash = WPubkeyHash::hash(&keys.pubkeys().payment_basepoint.serialize());
1046+
let remote_payment_script = Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&payment_base_key_hash[..]).into_script();
10651047

10661048
let mut onchain_tx_handler = OnchainTxHandler::new(destination_script.clone(), keys.clone(), their_to_self_delay, logger.clone());
10671049

@@ -1090,7 +1072,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
10901072

10911073
destination_script: destination_script.clone(),
10921074
broadcasted_local_revokable_script: None,
1093-
broadcasted_remote_payment_script: None,
1075+
remote_payment_script,
10941076
shutdown_script,
10951077

10961078
keys,
@@ -1227,17 +1209,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
12271209
}
12281210
}
12291211

1230-
pub(super) fn provide_rescue_remote_commitment_tx_info(&mut self, their_revocation_point: PublicKey) {
1231-
if let Ok(payment_key) = chan_utils::derive_public_key(&self.secp_ctx, &their_revocation_point, &self.keys.pubkeys().payment_basepoint) {
1232-
let to_remote_script = Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0)
1233-
.push_slice(&WPubkeyHash::hash(&payment_key.serialize())[..])
1234-
.into_script();
1235-
if let Ok(to_remote_key) = chan_utils::derive_private_key(&self.secp_ctx, &their_revocation_point, &self.keys.payment_base_key()) {
1236-
self.broadcasted_remote_payment_script = Some((to_remote_script, to_remote_key));
1237-
}
1238-
}
1239-
}
1240-
12411212
/// Informs this monitor of the latest local (ie broadcastable) commitment transaction. The
12421213
/// monitor watches for timeouts and may broadcast it if we approach such a timeout. Thus, it
12431214
/// is important that any clones of this channel monitor (including remote clones) by kept
@@ -1302,8 +1273,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
13021273
self.provide_payment_preimage(&PaymentHash(Sha256::hash(&payment_preimage.0[..]).into_inner()), &payment_preimage),
13031274
ChannelMonitorUpdateStep::CommitmentSecret { idx, secret } =>
13041275
self.provide_secret(idx, secret)?,
1305-
ChannelMonitorUpdateStep::RescueRemoteCommitmentTXInfo { their_current_per_commitment_point } =>
1306-
self.provide_rescue_remote_commitment_tx_info(their_current_per_commitment_point),
13071276
ChannelMonitorUpdateStep::ChannelForceClosed { .. } => {},
13081277
}
13091278
}
@@ -1333,8 +1302,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
13331302
self.provide_payment_preimage(&PaymentHash(Sha256::hash(&payment_preimage.0[..]).into_inner()), &payment_preimage),
13341303
ChannelMonitorUpdateStep::CommitmentSecret { idx, secret } =>
13351304
self.provide_secret(idx, secret)?,
1336-
ChannelMonitorUpdateStep::RescueRemoteCommitmentTXInfo { their_current_per_commitment_point } =>
1337-
self.provide_rescue_remote_commitment_tx_info(their_current_per_commitment_point),
13381305
ChannelMonitorUpdateStep::ChannelForceClosed { should_broadcast } => {
13391306
self.lockdown_from_offchain = true;
13401307
if should_broadcast {
@@ -1449,20 +1416,12 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
14491416
let revocation_pubkey = ignore_error!(chan_utils::derive_public_revocation_key(&self.secp_ctx, &per_commitment_point, &self.keys.pubkeys().revocation_basepoint));
14501417
let revocation_key = ignore_error!(chan_utils::derive_private_revocation_key(&self.secp_ctx, &per_commitment_key, &self.keys.revocation_base_key()));
14511418
let b_htlc_key = ignore_error!(chan_utils::derive_public_key(&self.secp_ctx, &per_commitment_point, &self.keys.pubkeys().htlc_basepoint));
1452-
let local_payment_key = ignore_error!(chan_utils::derive_private_key(&self.secp_ctx, &per_commitment_point, &self.keys.payment_base_key()));
14531419
let delayed_key = ignore_error!(chan_utils::derive_public_key(&self.secp_ctx, &PublicKey::from_secret_key(&self.secp_ctx, &per_commitment_key), &self.their_delayed_payment_base_key));
14541420
let a_htlc_key = ignore_error!(chan_utils::derive_public_key(&self.secp_ctx, &PublicKey::from_secret_key(&self.secp_ctx, &per_commitment_key), &self.their_htlc_base_key));
14551421

14561422
let revokeable_redeemscript = chan_utils::get_revokeable_redeemscript(&revocation_pubkey, self.our_to_self_delay, &delayed_key);
14571423
let revokeable_p2wsh = revokeable_redeemscript.to_v0_p2wsh();
14581424

1459-
self.broadcasted_remote_payment_script = {
1460-
// Note that the Network here is ignored as we immediately drop the address for the
1461-
// script_pubkey version
1462-
let payment_hash160 = WPubkeyHash::hash(&PublicKey::from_secret_key(&self.secp_ctx, &local_payment_key).serialize());
1463-
Some((Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&payment_hash160[..]).into_script(), local_payment_key))
1464-
};
1465-
14661425
// First, process non-htlc outputs (to_local & to_remote)
14671426
for (idx, outp) in tx.output.iter().enumerate() {
14681427
if outp.script_pubkey == revokeable_p2wsh {
@@ -1603,14 +1562,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
16031562
let b_htlc_key = ignore_error!(chan_utils::derive_public_key(&self.secp_ctx, revocation_point, &self.keys.pubkeys().htlc_basepoint));
16041563
let htlc_privkey = ignore_error!(chan_utils::derive_private_key(&self.secp_ctx, revocation_point, &self.keys.htlc_base_key()));
16051564
let a_htlc_key = ignore_error!(chan_utils::derive_public_key(&self.secp_ctx, revocation_point, &self.their_htlc_base_key));
1606-
let local_payment_key = ignore_error!(chan_utils::derive_private_key(&self.secp_ctx, revocation_point, &self.keys.payment_base_key()));
1607-
1608-
self.broadcasted_remote_payment_script = {
1609-
// Note that the Network here is ignored as we immediately drop the address for the
1610-
// script_pubkey version
1611-
let payment_hash160 = WPubkeyHash::hash(&PublicKey::from_secret_key(&self.secp_ctx, &local_payment_key).serialize());
1612-
Some((Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&payment_hash160[..]).into_script(), local_payment_key))
1613-
};
16141565

16151566
// Then, try to find htlc outputs
16161567
for (_, &(ref htlc, _)) in per_commitment_data.iter().enumerate() {
@@ -2176,15 +2127,13 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
21762127
});
21772128
break;
21782129
}
2179-
} else if let Some(ref broadcasted_remote_payment_script) = self.broadcasted_remote_payment_script {
2180-
if broadcasted_remote_payment_script.0 == outp.script_pubkey {
2181-
spendable_output = Some(SpendableOutputDescriptor::DynamicOutputP2WPKH {
2182-
outpoint: BitcoinOutPoint { txid: tx.txid(), vout: i as u32 },
2183-
key: broadcasted_remote_payment_script.1,
2184-
output: outp.clone(),
2185-
});
2186-
break;
2187-
}
2130+
} else if self.remote_payment_script == outp.script_pubkey {
2131+
spendable_output = Some(SpendableOutputDescriptor::DynamicOutputP2WPKH {
2132+
outpoint: BitcoinOutPoint { txid: tx.txid(), vout: i as u32 },
2133+
key: self.keys.payment_base_key().clone(),
2134+
output: outp.clone(),
2135+
});
2136+
break;
21882137
} else if outp.script_pubkey == self.shutdown_script {
21892138
spendable_output = Some(SpendableOutputDescriptor::StaticOutput {
21902139
outpoint: BitcoinOutPoint { txid: tx.txid(), vout: i as u32 },
@@ -2240,15 +2189,7 @@ impl<ChanSigner: ChannelKeys + Readable> ReadableArgs<Arc<Logger>> for (BlockHas
22402189
1 => { None },
22412190
_ => return Err(DecodeError::InvalidValue),
22422191
};
2243-
let broadcasted_remote_payment_script = match <u8 as Readable>::read(reader)? {
2244-
0 => {
2245-
let payment_address = Readable::read(reader)?;
2246-
let payment_key = Readable::read(reader)?;
2247-
Some((payment_address, payment_key))
2248-
},
2249-
1 => { None },
2250-
_ => return Err(DecodeError::InvalidValue),
2251-
};
2192+
let remote_payment_script = Readable::read(reader)?;
22522193
let shutdown_script = Readable::read(reader)?;
22532194

22542195
let keys = Readable::read(reader)?;
@@ -2464,7 +2405,7 @@ impl<ChanSigner: ChannelKeys + Readable> ReadableArgs<Arc<Logger>> for (BlockHas
24642405

24652406
destination_script,
24662407
broadcasted_local_revokable_script,
2467-
broadcasted_remote_payment_script,
2408+
remote_payment_script,
24682409
shutdown_script,
24692410

24702411
keys,

lightning/src/ln/features.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ mod sealed {
8989
// Byte 0
9090
,
9191
// Byte 1
92-
,
92+
StaticRemoteKey,
9393
// Byte 2
9494
,
9595
],
9696
optional_features: [
9797
// Byte 0
9898
DataLossProtect | InitialRoutingSync | UpfrontShutdownScript,
9999
// Byte 1
100-
VariableLengthOnion | StaticRemoteKey | PaymentSecret,
100+
VariableLengthOnion | PaymentSecret,
101101
// Byte 2
102102
BasicMPP,
103103
],
@@ -107,15 +107,15 @@ mod sealed {
107107
// Byte 0
108108
,
109109
// Byte 1
110-
,
110+
StaticRemoteKey,
111111
// Byte 2
112112
,
113113
],
114114
optional_features: [
115115
// Byte 0
116116
DataLossProtect | UpfrontShutdownScript,
117117
// Byte 1
118-
VariableLengthOnion | StaticRemoteKey | PaymentSecret,
118+
VariableLengthOnion | PaymentSecret,
119119
// Byte 2
120120
BasicMPP,
121121
],
@@ -608,11 +608,11 @@ mod tests {
608608
{
609609
// Check that the flags are as expected:
610610
// - option_data_loss_protect
611-
// - var_onion_optin | static_remote_key | payment_secret
611+
// - var_onion_optin | static_remote_key (req) | payment_secret
612612
// - basic_mpp
613613
assert_eq!(node_features.flags.len(), 3);
614614
assert_eq!(node_features.flags[0], 0b00000010);
615-
assert_eq!(node_features.flags[1], 0b10100010);
615+
assert_eq!(node_features.flags[1], 0b10010010);
616616
assert_eq!(node_features.flags[2], 0b00000010);
617617
}
618618

lightning/src/ln/functional_tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6807,7 +6807,7 @@ fn test_data_loss_protect() {
68076807
// We want to be sure that :
68086808
// * we don't broadcast our Local Commitment Tx in case of fallen behind
68096809
// * we close channel in case of detecting other being fallen behind
6810-
// * we are able to claim our own outputs thanks to remote my_current_per_commitment_point
6810+
// * we are able to claim our own outputs thanks to to_remote being static
68116811
let keys_manager;
68126812
let fee_estimator;
68136813
let tx_broadcaster;
@@ -6868,9 +6868,9 @@ fn test_data_loss_protect() {
68686868

68696869
let reestablish_0 = get_chan_reestablish_msgs!(nodes[1], nodes[0]);
68706870

6871-
// Check we update monitor following learning of per_commitment_point from B
6871+
// Check we don't broadcast any transactions following learning of per_commitment_point from B
68726872
nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &reestablish_0[0]);
6873-
check_added_monitors!(nodes[0], 2);
6873+
check_added_monitors!(nodes[0], 1);
68746874

68756875
{
68766876
let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();

lightning/src/ln/peer_handler.rs

+4
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,10 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
641641
peer.sync_status = InitSyncTracker::ChannelsSyncing(0);
642642
peers.peers_needing_send.insert(peer_descriptor.clone());
643643
}
644+
if !msg.features.supports_static_remote_key() {
645+
log_debug!(self, "Peer {} does not support static remote key, disconnecting with no_connection_possible", log_pubkey!(peer.their_node_id.unwrap()));
646+
return Err(PeerHandleError{ no_connection_possible: true });
647+
}
644648

645649
if !peer.outbound {
646650
let mut features = InitFeatures::known();

0 commit comments

Comments
 (0)