Skip to content

Commit 2fc21b3

Browse files
committed
f Use PaymentHash::from rather than manually hashing the preimage
1 parent 9782219 commit 2fc21b3

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

@@ -1230,7 +1229,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
12301229
}
12311230

12321231
let payment_preimage = PaymentPreimage(self.keys_manager.get_secure_random_bytes());
1233-
let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array());
1232+
let payment_hash = PaymentHash::from(payment_preimage);
12341233

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

0 commit comments

Comments
 (0)