From 9fe3e7b4996c478f264de59c68a780dad764759b Mon Sep 17 00:00:00 2001 From: Sosthene Date: Wed, 22 May 2024 20:52:16 +0200 Subject: [PATCH] nit: output value is exactly what's available in the input for confirmation --- src/silentpayments.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/silentpayments.rs b/src/silentpayments.rs index 5688af0..c7e7ba3 100644 --- a/src/silentpayments.rs +++ b/src/silentpayments.rs @@ -73,7 +73,7 @@ pub fn create_transaction(sp_address: SilentPaymentAddress, sp_wallet: &SpWallet pub fn create_transaction_spend_outpoint( outpoint: &OutPoint, sp_wallet: &SpWallet, - recipient: Recipient, + mut recipient: Recipient, fee_rate: Amount ) -> Result { let available_outpoints = sp_wallet.get_outputs().to_spendable_list(); @@ -96,6 +96,9 @@ pub fn create_transaction_spend_outpoint( return Err(Error::msg("Not enough available funds")); } + // update the amount for the recipient + recipient.amount = total_available; + // create a dummy commitment let mut buf = [0u8;64]; thread_rng().fill_bytes(&mut buf);