]> git.bitcoin.ninja Git - rust-lightning/commitdiff
f make comment about fuzztarget pk validity more clear
authorMatt Corallo <git@bluematt.me>
Sun, 3 May 2020 02:10:05 +0000 (22:10 -0400)
committerMatt Corallo <git@bluematt.me>
Sun, 3 May 2020 02:10:05 +0000 (22:10 -0400)
lightning/src/ln/channel.rs

index d9327dd55f7eafa6d3cfab3d1283f3fedf632ed0..7a483ae142fb9d23f550e0c33239ac91c2da79d5 100644 (file)
@@ -3459,7 +3459,10 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
        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();