From 2e69a6ca900f163f37f92be9eafa33cb8f6afea0 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 2 May 2020 22:10:05 -0400 Subject: [PATCH] f make comment about fuzztarget pk validity more clear --- lightning/src/ln/channel.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index d9327dd55..7a483ae14 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -3459,7 +3459,10 @@ impl Channel { pub fn get_channel_reestablish(&self) -> msgs::ChannelReestablish { assert_eq!(self.channel_state & ChannelState::PeerDisconnected as u32, ChannelState::PeerDisconnected as u32); assert_ne!(self.cur_remote_commitment_transaction_number, INITIAL_COMMITMENT_NUMBER); - let mut pk = [2; 33]; pk[1] = 0xff; // Select a dummy pubkey which is valid in both "real" and fuzztarget modes + // fuzztarget mode marks a subset of pubkeys as invalid so that we can hit "invalid pubkey" + // branches, but we unwrap it below, so we arbitrarily select a dummy pubkey which is both + // valid, and valid in fuzztarget mode's arbitrary validity criteria: + let mut pk = [2; 33]; pk[1] = 0xff; let dummy_pubkey = PublicKey::from_slice(&pk).unwrap(); let data_loss_protect = if self.cur_remote_commitment_transaction_number + 1 < INITIAL_COMMITMENT_NUMBER { let remote_last_secret = self.commitment_secrets.get_secret(self.cur_remote_commitment_transaction_number + 2).unwrap(); -- 2.39.5