nit: output value is exactly what's available in the input for confirmation

This commit is contained in:
Sosthene 2024-05-22 20:52:16 +02:00
parent f5cdb7e2f1
commit 9fe3e7b499

View File

@ -73,7 +73,7 @@ pub fn create_transaction(sp_address: SilentPaymentAddress, sp_wallet: &SpWallet
pub fn create_transaction_spend_outpoint( pub fn create_transaction_spend_outpoint(
outpoint: &OutPoint, outpoint: &OutPoint,
sp_wallet: &SpWallet, sp_wallet: &SpWallet,
recipient: Recipient, mut recipient: Recipient,
fee_rate: Amount fee_rate: Amount
) -> Result<Psbt> { ) -> Result<Psbt> {
let available_outpoints = sp_wallet.get_outputs().to_spendable_list(); 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")); return Err(Error::msg("Not enough available funds"));
} }
// update the amount for the recipient
recipient.amount = total_available;
// create a dummy commitment // create a dummy commitment
let mut buf = [0u8;64]; let mut buf = [0u8;64];
thread_rng().fill_bytes(&mut buf); thread_rng().fill_bytes(&mut buf);