diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2022-12-06 10:30:54 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2022-12-06 10:31:02 +0100 |
commit | edbe4f808a05ebd582c95e469ebcd1c87288dac0 (patch) | |
tree | 6aac54c4553a94afe6617a0671532f33a5560889 /src/wallet | |
parent | 5d9b5305af4aaf9d4903d9d2996c5eea613b51a1 (diff) | |
parent | 3eb041f014870954db564369a4be4bd0dea48fbe (diff) | |
download | bitcoin-edbe4f808a05ebd582c95e469ebcd1c87288dac0.tar.xz |
Merge bitcoin/bitcoin#26611: wallet: Change coin selection fee assert to error
3eb041f014870954db564369a4be4bd0dea48fbe wallet: Change coin selection fee assert to error (Andrew Chow)
c6e7f224c119f47af250a9e0c5b185cb98b30c4c util: Add StrFormatInternalBug and STR_INTERNAL_BUG (MarcoFalke)
Pull request description:
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.
ACKs for top commit:
S3RK:
ACK 3eb041f014870954db564369a4be4bd0dea48fbe
aureleoules:
ACK 3eb041f014870954db564369a4be4bd0dea48fbe
furszy:
ACK 3eb041f0
Tree-SHA512: 118c13d7cdfce492080edd4cb12e6d960695377b978c7573f9c58b6d918664afd0e8e591eed0605d08ac756fa8eceed456349de5f3a025174069abf369bb5a5f
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/spend.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 52d10b74b5..c6c6ec0b89 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -955,7 +955,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) { |