Skip to content

Commit aef31ae

Browse files
authored
Merge pull request #211 from f3r10/use_from_paymentpreimage_when_constructing_payment_hash
refactor(simln-lib): use from<paymentpreimage> when constructing paym…
2 parents efb1fe0 + ed1e2a9 commit aef31ae

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

simln-lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ expanduser = "1.2.2"
1616
serde = { version="1.0.183", features=["derive"] }
1717
serde_json = "1.0.104"
1818
bitcoin = { version = "0.30.1", features=["serde"] }
19-
lightning = { version = "0.0.121" }
19+
lightning = { version = "0.0.123" }
2020
tonic_lnd = { package="fedimint-tonic-lnd", version="0.1.2", features=["lightningrpc", "routerrpc"]}
2121
tonic = { version = "0.8", features = ["tls", "transport"] }
2222
async-trait = "0.1.73"

simln-lib/src/sim_node.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::{
33
};
44
use async_trait::async_trait;
55
use bitcoin::constants::ChainHash;
6-
use bitcoin::hashes::{sha256::Hash as Sha256, Hash};
76
use bitcoin::secp256k1::PublicKey;
87
use bitcoin::{Network, ScriptBuf, TxOut};
98
use lightning::ln::chan_utils::make_funding_redeemscript;
@@ -541,7 +540,7 @@ impl<T: SimNetwork> LightningNode for SimNode<'_, T> {
541540
// our internal tracking state along with the chosen payment hash.
542541
let (sender, receiver) = channel();
543542
let preimage = PaymentPreimage(rand::random());
544-
let payment_hash = PaymentHash(Sha256::hash(&preimage.0).to_byte_array());
543+
let payment_hash = preimage.into();
545544

546545
// Check for payment hash collision, failing the payment if we happen to repeat one.
547546
match self.in_flight.entry(payment_hash) {

0 commit comments

Comments
 (0)