Skip to content

Commit

Permalink
Fix scid_utils::is_valid* false positive
Browse files Browse the repository at this point in the history
cargo bench was able to find an scid of 0 as a valid intercept id
  • Loading branch information
valentinewallace committed Nov 7, 2022
1 parent 7d43091 commit 8e3a664
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lightning/src/util/scid_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub(crate) mod fake_scid {
let tx_index = scid_utils::tx_index_from_scid(&scid);
let namespace = Namespace::Phantom;
let valid_vout = namespace.get_encrypted_vout(block_height, tx_index, fake_scid_rand_bytes);
valid_vout == scid_utils::vout_from_scid(&scid) as u8
scid != 0 && valid_vout == scid_utils::vout_from_scid(&scid) as u8
}

/// Returns whether the given fake scid falls into the intercept namespace.
Expand All @@ -167,7 +167,7 @@ pub(crate) mod fake_scid {
let tx_index = scid_utils::tx_index_from_scid(&scid);
let namespace = Namespace::Intercept;
let valid_vout = namespace.get_encrypted_vout(block_height, tx_index, fake_scid_rand_bytes);
valid_vout == scid_utils::vout_from_scid(&scid) as u8
scid != 0 && valid_vout == scid_utils::vout_from_scid(&scid) as u8
}

#[cfg(test)]
Expand Down

0 comments on commit 8e3a664

Please sign in to comment.