mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
This commit is contained in:
parent
a638bd7499
commit
3ee01055ed
1 changed files with 10 additions and 2 deletions
|
@ -258,8 +258,16 @@ where
|
|||
})?;
|
||||
}
|
||||
|
||||
// Check if we need to use a change address
|
||||
if total > amount_with_fee {
|
||||
// The amount with fee is more than the total values of our max outputs
|
||||
if total < amount_with_fee && coins.len() == max_outputs {
|
||||
return Err(ErrorKind::NotEnoughFunds {
|
||||
available: total,
|
||||
needed: amount_with_fee as u64,
|
||||
})?;
|
||||
}
|
||||
|
||||
// We need to add a change address or amount with fee is more than total
|
||||
if total != amount_with_fee {
|
||||
fee = tx_fee(coins.len(), 2, None);
|
||||
amount_with_fee = amount + fee;
|
||||
|
||||
|
|
Loading…
Reference in a new issue