From 62305c4213799dc978b4385d709374e7bf79e3f2 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Mon, 29 Jul 2024 11:02:26 +0100 Subject: [PATCH] Renaming a few things in HTLC creation to make flow more memorable --- side-node/src/bitcoin/driver/htlc.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/side-node/src/bitcoin/driver/htlc.rs b/side-node/src/bitcoin/driver/htlc.rs index ceafdf0..6ff28c3 100644 --- a/side-node/src/bitcoin/driver/htlc.rs +++ b/side-node/src/bitcoin/driver/htlc.rs @@ -11,18 +11,14 @@ pub(crate) async fn run() -> anyhow::Result<()> { // format a new commitment transaction like in Lightning let mut commitment_builder = dave.wallet.build_tx(); - let amount = 500; + let value = 500; let recipient = sammy.wallet.get_address(New)?.script_pubkey(); - let hash_preimage = utils::sha256("blah".to_string()); + let hash_preimage = "blah".to_string(); + let hashlock = utils::sha256(hash_preimage); - // Feed it 500 sats, a redeem identity, a hashlock, a refund timelock, and a refund identity + // Feed it a redeem identity, a hashlock from the preimage, a refund timelock, and a refund identity // - let htlc = bitcoin::htlc::Htlc::new( - dave.external_public_key, - hash_preimage, - 100, - sammy.external_public_key, - ); + let htlc = bitcoin::htlc::Htlc::new(dave.public_key, hashlock, 100, sammy.public_key); let htlc_descriptor = htlc.to_miniscript_descriptor(); tracing::info!("descriptor: {}", htlc_descriptor);