Skip to content

Commit

Permalink
f Use PaymentHash::from rather than manually hashing the preimage
Browse files Browse the repository at this point in the history
  • Loading branch information
tnull committed Mar 25, 2024
1 parent cfc2066 commit 2a1bca7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ use lightning_transaction_sync::EsploraSyncClient;
use lightning::routing::router::{PaymentParameters, RouteParameters};
use lightning_invoice::{payment, Bolt11Invoice, Currency};

use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hashes::Hash;
use bitcoin::secp256k1::PublicKey;

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

let payment_preimage = PaymentPreimage(self.keys_manager.get_secure_random_bytes());
let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array());
let payment_hash = PaymentHash::from(payment_preimage);

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

0 comments on commit 2a1bca7

Please sign in to comment.