Skip to content

Commit f863904

Browse files
committed
f Use PaymentHash::from rather than manually hashing the preimage
1 parent 1f5a07c commit f863904

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ use lightning_transaction_sync::EsploraSyncClient;
157157
use lightning::routing::router::{PaymentParameters, RouteParameters};
158158
use lightning_invoice::{payment, Bolt11Invoice, Currency};
159159

160-
use bitcoin::hashes::sha256::Hash as Sha256;
161160
use bitcoin::hashes::Hash;
162161
use bitcoin::secp256k1::PublicKey;
163162

@@ -1301,7 +1300,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
13011300
}
13021301

13031302
let payment_preimage = PaymentPreimage(self.keys_manager.get_secure_random_bytes());
1304-
let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array());
1303+
let payment_hash = PaymentHash::from(payment_preimage);
13051304

13061305
if let Some(payment) = self.payment_store.get(&payment_hash) {
13071306
if payment.status == PaymentStatus::Pending

0 commit comments

Comments
 (0)