Skip to content

Commit e213ba5

Browse files
committed
Use 64 byte preimage.
1 parent d1bf102 commit e213ba5

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
@@ -2747,9 +2747,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
27472747
pub fn send_probe_payment(&self, route: &Route) -> Result<(PaymentHash, PaymentId), PaymentSendFailure> {
27482748
let payment_id = PaymentId(self.keys_manager.get_secure_random_bytes());
27492749

2750-
let mut preimage = [0u8; 32];
2751-
preimage[..16].copy_from_slice(&self.probing_cookie_secret[..16]);
2752-
preimage[16..].copy_from_slice(&payment_id.0[..16]);
2750+
let mut preimage = [0u8; 64];
2751+
preimage[..32].copy_from_slice(&self.probing_cookie_secret);
2752+
preimage[32..].copy_from_slice(&payment_id.0);
27532753

27542754
let payment_hash = PaymentHash(Sha256::hash(&preimage).into_inner());
27552755

@@ -2768,9 +2768,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
27682768
/// Returns whether a payment with the given [`PaymentHash`] and [`PaymentId`] is, in fact, a
27692769
/// payment probe.
27702770
pub fn payment_is_probe(&self, payment_hash: PaymentHash, payment_id: PaymentId) -> bool {
2771-
let mut preimage = [0u8; 32];
2772-
preimage[..16].copy_from_slice(&self.probing_cookie_secret[..16]);
2773-
preimage[16..].copy_from_slice(&payment_id.0[..16]);
2771+
let mut preimage = [0u8; 64];
2772+
preimage[..32].copy_from_slice(&self.probing_cookie_secret);
2773+
preimage[32..].copy_from_slice(&payment_id.0);
27742774
let target_payment_hash = PaymentHash(Sha256::hash(&preimage).into_inner());
27752775
target_payment_hash == payment_hash
27762776
}

0 commit comments

Comments
 (0)