diff options
author | MacroFake <falke.marco@gmail.com> | 2022-09-15 08:45:04 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-09-15 08:45:08 +0200 |
commit | 718304d222671f98d2335cd9b90a3022f62d7b21 (patch) | |
tree | 6be1e2ee64b9744945c6d4db175cf6da3dc13215 /src | |
parent | 2e3cd26a1a5e071407b79cf02c35f6cf42aa6191 (diff) | |
parent | 6f8e3818af7585b961039bf0c768be2e4ee44e0f (diff) |
Merge bitcoin/bitcoin#26084: sendall: check if the maxtxfee has been exceeded
6f8e3818af7585b961039bf0c768be2e4ee44e0f sendall: check if the maxtxfee has been exceeded (ishaanam)
Pull request description:
Previously the `sendall` RPC didn't check whether the fees of the transaction it creates exceed the set `maxtxfee`. This PR adds this check to `sendall` and a test case for it.
ACKs for top commit:
achow101:
ACK 6f8e3818af7585b961039bf0c768be2e4ee44e0f
Xekyo:
ACK 6f8e3818af7585b961039bf0c768be2e4ee44e0f
glozow:
Concept ACK 6f8e3818af7585b961039bf0c768be2e4ee44e0f. The high feerate is unlikely but sendall should respect the existing wallet options.
Tree-SHA512: 6ef0961937091293d49be16f17e4451cff3159d901c0c7c6e508883999dfe0c20ed4d7126bf74bfea8150d4c1eef961a45f0c28ef64562e6cb817fede2319f1a
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/rpc/spend.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index cd55596b9f..68e392790a 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -1402,6 +1402,10 @@ RPCHelpMan sendall() const CAmount fee_from_size{fee_rate.GetFee(tx_size.vsize)}; const CAmount effective_value{total_input_value - fee_from_size}; + if (fee_from_size > pwallet->m_default_max_tx_fee) { + throw JSONRPCError(RPC_WALLET_ERROR, TransactionErrorString(TransactionError::MAX_FEE_EXCEEDED).original); + } + if (effective_value <= 0) { if (send_max) { throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Total value of UTXO pool too low to pay for transaction, try using lower feerate."); |