mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
wallet: Change coin selection fee assert to error
Returning an error instead of asserting for the low fee check will be better as it does not crash the node and instructs users to report the bug.
This commit is contained in:
parent
c6e7f224c1
commit
3eb041f014
1 changed files with 3 additions and 1 deletions
|
@ -940,7 +940,9 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
|
|||
|
||||
// The only time that fee_needed should be less than the amount available for fees is when
|
||||
// we are subtracting the fee from the outputs. If this occurs at any other time, it is a bug.
|
||||
assert(coin_selection_params.m_subtract_fee_outputs || fee_needed <= nFeeRet);
|
||||
if (!coin_selection_params.m_subtract_fee_outputs && fee_needed > nFeeRet) {
|
||||
return util::Error{Untranslated(STR_INTERNAL_BUG("Fee needed > fee paid"))};
|
||||
}
|
||||
|
||||
// If there is a change output and we overpay the fees then increase the change to match the fee needed
|
||||
if (nChangePosInOut != -1 && fee_needed < nFeeRet) {
|
||||
|
|
Loading…
Reference in a new issue