Using the sha256 utils to generate a hash preimage for the htlc

This commit is contained in:
Dave Hrycyszyn
2024-07-29 10:41:10 +01:00
parent e1e2f49957
commit 2ced899c6b
3 changed files with 5 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
use crate::bitcoin::{self, driver};
use crate::utils;
use bdk::wallet::AddressIndex::New;
use bdk::SignOptions;
@@ -14,12 +15,13 @@ pub(crate) async fn run() -> anyhow::Result<()> {
let mut commitment_builder = dave.wallet.build_tx();
let amount = 500;
let recipient = sammy.wallet.get_address(New)?.script_pubkey();
let hash_preimage = utils::sha256("blah".to_string());
// Feed it 500 sats, a redeem identity, a hashlock, a refund timelock, and a refund identity
//
let htlc = bitcoin::htlc::Htlc::new(
dave.external_public_key,
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff".to_string(),
hash_preimage,
100,
sammy.external_public_key,
);