Estimate fee correctly for --send-all

This commit is contained in:
Ori Newman 2024-09-18 13:57:44 +03:00
parent 2d25c3d7a3
commit decbcd8233

View File

@ -196,9 +196,12 @@ func (s *server) selectUTXOsWithPreselected(preSelectedUTXOs []*walletUTXO, allo
})
totalValue += utxo.UTXOEntry.Amount()
// We're overestimating a bit by assuming that any transaction will have a change output
fee, err = s.estimateFee(selectedUTXOs, feeRate, maxFee, spendAmount)
estimatedRecipientValue := spendAmount
if isSendAll {
estimatedRecipientValue = totalValue
}
fee, err = s.estimateFee(selectedUTXOs, feeRate, maxFee, estimatedRecipientValue)
if err != nil {
return false, err
}