Skip to content

Commit 4068f15

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 d2c28a2 commit 4068f15

9 files changed

+248
-326
lines changed

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
@@ -263,11 +263,9 @@ pub struct TxCreationKeys {
263263
pub(crate) b_htlc_key: PublicKey,
264264
/// A's Payment Key (which isn't allowed to be spent from for some delay)
265265
pub(crate) a_delayed_payment_key: PublicKey,
266-
/// B's Payment Key
267-
pub(crate) b_payment_key: PublicKey,
268266
}
269267
impl_writeable!(TxCreationKeys, 33*6,
270-
{ per_commitment_point, revocation_key, a_htlc_key, b_htlc_key, a_delayed_payment_key, b_payment_key });
268+
{ per_commitment_point, revocation_key, a_htlc_key, b_htlc_key, a_delayed_payment_key });
271269

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

303301

304302
impl TxCreationKeys {
305-
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> {
303+
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> {
306304
Ok(TxCreationKeys {
307305
per_commitment_point: per_commitment_point.clone(),
308306
revocation_key: derive_public_revocation_key(&secp_ctx, &per_commitment_point, &b_revocation_base)?,
309307
a_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &a_htlc_base)?,
310308
b_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &b_htlc_base)?,
311309
a_delayed_payment_key: derive_public_key(&secp_ctx, &per_commitment_point, &a_delayed_payment_base)?,
312-
b_payment_key: derive_public_key(&secp_ctx, &per_commitment_point, &b_payment_base)?,
313310
})
314311
}
315312
}
@@ -538,7 +535,6 @@ impl LocalCommitmentTransaction {
538535
a_htlc_key: dummy_key.clone(),
539536
b_htlc_key: dummy_key.clone(),
540537
a_delayed_payment_key: dummy_key.clone(),
541-
b_payment_key: dummy_key.clone(),
542538
},
543539
feerate_per_kw: 0,
544540
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
@@ -251,7 +251,7 @@ impl MsgHandleErrInternal {
251251
},
252252
},
253253
},
254-
ChannelError::CloseDelayBroadcast { msg, .. } => LightningError {
254+
ChannelError::CloseDelayBroadcast(msg) => LightningError {
255255
err: msg,
256256
action: msgs::ErrorAction::SendErrorMessage {
257257
msg: msgs::ErrorMessage {
@@ -574,8 +574,9 @@ macro_rules! break_chan_entry {
574574
if let Some(short_id) = chan.get_short_channel_id() {
575575
$channel_state.short_to_id.remove(&short_id);
576576
}
577-
break Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, chan.force_shutdown(true), $self.get_channel_update(&chan).ok())) },
578-
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"); }
577+
break Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, chan.force_shutdown(true), $self.get_channel_update(&chan).ok()))
578+
},
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"); }
579580
}
580581
}
581582
}
@@ -595,22 +596,12 @@ macro_rules! try_chan_entry {
595596
}
596597
return Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, chan.force_shutdown(true), $self.get_channel_update(&chan).ok()))
597598
},
598-
Err(ChannelError::CloseDelayBroadcast { msg, update }) => {
599+
Err(ChannelError::CloseDelayBroadcast(msg)) => {
599600
log_error!($self, "Channel {} need to be shutdown but closing transactions not broadcast due to {}", log_bytes!($entry.key()[..]), msg);
600601
let (channel_id, mut chan) = $entry.remove_entry();
601602
if let Some(short_id) = chan.get_short_channel_id() {
602603
$channel_state.short_to_id.remove(&short_id);
603604
}
604-
if let Err(e) = $self.monitor.update_monitor(chan.get_funding_txo().unwrap(), update) {
605-
match e {
606-
// Upstream channel is dead, but we want at least to fail backward HTLCs to save
607-
// downstream channels. In case of PermanentFailure, we are not going to be able
608-
// to claim back to_remote output on remote commitment transaction. Doesn't
609-
// make a difference here, we are concern about HTLCs circuit, not onchain funds.
610-
ChannelMonitorUpdateErr::PermanentFailure => {},
611-
ChannelMonitorUpdateErr::TemporaryFailure => {},
612-
}
613-
}
614605
let shutdown_res = chan.force_shutdown(false);
615606
return Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, shutdown_res, $self.get_channel_update(&chan).ok()))
616607
}
@@ -1664,7 +1655,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref> ChannelMan
16641655
}
16651656
Err(MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, channel.force_shutdown(true), self.get_channel_update(&channel).ok()))
16661657
},
1667-
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"); }
1658+
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"); }
16681659
};
16691660
handle_errors.push((their_node_id, err));
16701661
continue;

lightning/src/ln/channelmonitor.rs

+16-75
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,6 @@ pub(super) enum ChannelMonitorUpdateStep {
590590
idx: u64,
591591
secret: [u8; 32],
592592
},
593-
/// Indicates our channel is likely a stale version, we're closing, but this update should
594-
/// allow us to spend what is ours if our counterparty broadcasts their latest state.
595-
RescueRemoteCommitmentTXInfo {
596-
their_current_per_commitment_point: PublicKey,
597-
},
598593
/// Used to indicate that the no future updates will occur, and likely that the latest local
599594
/// commitment transaction(s) should be broadcast, as the channel has been force-closed.
600595
ChannelForceClosed {
@@ -637,12 +632,8 @@ impl Writeable for ChannelMonitorUpdateStep {
637632
idx.write(w)?;
638633
secret.write(w)?;
639634
},
640-
&ChannelMonitorUpdateStep::RescueRemoteCommitmentTXInfo { ref their_current_per_commitment_point } => {
641-
4u8.write(w)?;
642-
their_current_per_commitment_point.write(w)?;
643-
},
644635
&ChannelMonitorUpdateStep::ChannelForceClosed { ref should_broadcast } => {
645-
5u8.write(w)?;
636+
4u8.write(w)?;
646637
should_broadcast.write(w)?;
647638
},
648639
}
@@ -692,11 +683,6 @@ impl Readable for ChannelMonitorUpdateStep {
692683
})
693684
},
694685
4u8 => {
695-
Ok(ChannelMonitorUpdateStep::RescueRemoteCommitmentTXInfo {
696-
their_current_per_commitment_point: Readable::read(r)?,
697-
})
698-
},
699-
5u8 => {
700686
Ok(ChannelMonitorUpdateStep::ChannelForceClosed {
701687
should_broadcast: Readable::read(r)?
702688
})
@@ -722,7 +708,7 @@ pub struct ChannelMonitor<ChanSigner: ChannelKeys> {
722708

723709
destination_script: Script,
724710
broadcasted_local_revokable_script: Option<(Script, SecretKey, Script)>,
725-
broadcasted_remote_payment_script: Option<(Script, SecretKey)>,
711+
remote_payment_script: Script,
726712
shutdown_script: Script,
727713

728714
keys: ChanSigner,
@@ -818,7 +804,7 @@ impl<ChanSigner: ChannelKeys> PartialEq for ChannelMonitor<ChanSigner> {
818804
self.commitment_transaction_number_obscure_factor != other.commitment_transaction_number_obscure_factor ||
819805
self.destination_script != other.destination_script ||
820806
self.broadcasted_local_revokable_script != other.broadcasted_local_revokable_script ||
821-
self.broadcasted_remote_payment_script != other.broadcasted_remote_payment_script ||
807+
self.remote_payment_script != other.remote_payment_script ||
822808
self.keys.pubkeys() != other.keys.pubkeys() ||
823809
self.funding_info != other.funding_info ||
824810
self.current_remote_commitment_txid != other.current_remote_commitment_txid ||
@@ -882,13 +868,7 @@ impl<ChanSigner: ChannelKeys + Writeable> ChannelMonitor<ChanSigner> {
882868
writer.write_all(&[1; 1])?;
883869
}
884870

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

894874
self.keys.write(writer)?;
@@ -1063,6 +1043,8 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
10631043
assert!(commitment_transaction_number_obscure_factor <= (1 << 48));
10641044
let our_channel_close_key_hash = Hash160::hash(&shutdown_pubkey.serialize());
10651045
let shutdown_script = Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&our_channel_close_key_hash[..]).into_script();
1046+
let payment_base_key_hash = Hash160::hash(&keys.pubkeys().payment_basepoint.serialize());
1047+
let remote_payment_script = Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&payment_base_key_hash[..]).into_script();
10661048

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

@@ -1091,7 +1073,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
10911073

10921074
destination_script: destination_script.clone(),
10931075
broadcasted_local_revokable_script: None,
1094-
broadcasted_remote_payment_script: None,
1076+
remote_payment_script,
10951077
shutdown_script,
10961078

10971079
keys,
@@ -1228,17 +1210,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
12281210
}
12291211
}
12301212

1231-
pub(super) fn provide_rescue_remote_commitment_tx_info(&mut self, their_revocation_point: PublicKey) {
1232-
if let Ok(payment_key) = chan_utils::derive_public_key(&self.secp_ctx, &their_revocation_point, &self.keys.pubkeys().payment_basepoint) {
1233-
let to_remote_script = Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0)
1234-
.push_slice(&Hash160::hash(&payment_key.serialize())[..])
1235-
.into_script();
1236-
if let Ok(to_remote_key) = chan_utils::derive_private_key(&self.secp_ctx, &their_revocation_point, &self.keys.payment_base_key()) {
1237-
self.broadcasted_remote_payment_script = Some((to_remote_script, to_remote_key));
1238-
}
1239-
}
1240-
}
1241-
12421213
/// Informs this monitor of the latest local (ie broadcastable) commitment transaction. The
12431214
/// monitor watches for timeouts and may broadcast it if we approach such a timeout. Thus, it
12441215
/// is important that any clones of this channel monitor (including remote clones) by kept
@@ -1303,8 +1274,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
13031274
self.provide_payment_preimage(&PaymentHash(Sha256::hash(&payment_preimage.0[..]).into_inner()), &payment_preimage),
13041275
ChannelMonitorUpdateStep::CommitmentSecret { idx, secret } =>
13051276
self.provide_secret(idx, secret)?,
1306-
ChannelMonitorUpdateStep::RescueRemoteCommitmentTXInfo { their_current_per_commitment_point } =>
1307-
self.provide_rescue_remote_commitment_tx_info(their_current_per_commitment_point),
13081277
ChannelMonitorUpdateStep::ChannelForceClosed { .. } => {},
13091278
}
13101279
}
@@ -1334,8 +1303,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
13341303
self.provide_payment_preimage(&PaymentHash(Sha256::hash(&payment_preimage.0[..]).into_inner()), &payment_preimage),
13351304
ChannelMonitorUpdateStep::CommitmentSecret { idx, secret } =>
13361305
self.provide_secret(idx, secret)?,
1337-
ChannelMonitorUpdateStep::RescueRemoteCommitmentTXInfo { their_current_per_commitment_point } =>
1338-
self.provide_rescue_remote_commitment_tx_info(their_current_per_commitment_point),
13391306
ChannelMonitorUpdateStep::ChannelForceClosed { should_broadcast } => {
13401307
self.lockdown_from_offchain = true;
13411308
if should_broadcast {
@@ -1450,20 +1417,12 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
14501417
let revocation_pubkey = ignore_error!(chan_utils::derive_public_revocation_key(&self.secp_ctx, &per_commitment_point, &self.keys.pubkeys().revocation_basepoint));
14511418
let revocation_key = ignore_error!(chan_utils::derive_private_revocation_key(&self.secp_ctx, &per_commitment_key, &self.keys.revocation_base_key()));
14521419
let b_htlc_key = ignore_error!(chan_utils::derive_public_key(&self.secp_ctx, &per_commitment_point, &self.keys.pubkeys().htlc_basepoint));
1453-
let local_payment_key = ignore_error!(chan_utils::derive_private_key(&self.secp_ctx, &per_commitment_point, &self.keys.payment_base_key()));
14541420
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));
14551421
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));
14561422

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

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

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

22552196
let keys = Readable::read(reader)?;
@@ -2465,7 +2406,7 @@ impl<ChanSigner: ChannelKeys + Readable> ReadableArgs<Arc<Logger>> for (Sha256dH
24652406

24662407
destination_script,
24672408
broadcasted_local_revokable_script,
2468-
broadcasted_remote_payment_script,
2409+
remote_payment_script,
24692410
shutdown_script,
24702411

24712412
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
],
@@ -528,11 +528,11 @@ mod tests {
528528
{
529529
// Check that the flags are as expected:
530530
// - option_data_loss_protect
531-
// - var_onion_optin | static_remote_key | payment_secret
531+
// - var_onion_optin | static_remote_key (req) | payment_secret
532532
// - basic_mpp
533533
assert_eq!(node_features.flags.len(), 3);
534534
assert_eq!(node_features.flags[0], 0b00000010);
535-
assert_eq!(node_features.flags[1], 0b10100010);
535+
assert_eq!(node_features.flags[1], 0b10010010);
536536
assert_eq!(node_features.flags[2], 0b00000010);
537537
}
538538

lightning/src/ln/functional_tests.rs

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

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

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

68746874
{
68756875
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)