Skip to content

Commit 22ac083

Browse files
committed
Use 64 byte preimage.
1 parent cdca052 commit 22ac083

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,9 +2738,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
27382738
pub fn send_probe_payment(&self, route: &Route) -> Result<(PaymentHash, PaymentId), PaymentSendFailure> {
27392739
let payment_id = PaymentId(self.keys_manager.get_secure_random_bytes());
27402740

2741-
let mut preimage = [0u8; 32];
2742-
preimage[..16].copy_from_slice(&self.probing_cookie_secret[..16]);
2743-
preimage[16..].copy_from_slice(&payment_id.0[..16]);
2741+
let mut preimage = [0u8; 64];
2742+
preimage[..32].copy_from_slice(&self.probing_cookie_secret);
2743+
preimage[32..].copy_from_slice(&payment_id.0);
27442744

27452745
let payment_hash = PaymentHash(Sha256::hash(&preimage).into_inner());
27462746

@@ -2759,9 +2759,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
27592759
/// Returns whether a payment with the given [`PaymentHash`] and [`PaymentId`] is, in fact, a
27602760
/// payment probe.
27612761
pub fn payment_is_probe(&self, payment_hash: PaymentHash, payment_id: PaymentId) -> bool {
2762-
let mut preimage = [0u8; 32];
2763-
preimage[..16].copy_from_slice(&self.probing_cookie_secret[..16]);
2764-
preimage[16..].copy_from_slice(&payment_id.0[..16]);
2762+
let mut preimage = [0u8; 64];
2763+
preimage[..32].copy_from_slice(&self.probing_cookie_secret);
2764+
preimage[32..].copy_from_slice(&payment_id.0);
27652765
let target_payment_hash = PaymentHash(Sha256::hash(&preimage).into_inner());
27662766
target_payment_hash == payment_hash
27672767
}

0 commit comments

Comments
 (0)