diff options
author | kouloumos <kouloumosa@gmail.com> | 2022-09-06 20:52:41 +0300 |
---|---|---|
committer | kouloumos <kouloumosa@gmail.com> | 2022-09-15 13:22:19 +0300 |
commit | cc434cbf583ec8d1b0f3aa504417231fdc81f33a (patch) | |
tree | 8946bdba3873a4dceb2162f95ed13303ba05267c /src/wallet/rpc | |
parent | 718304d222671f98d2335cd9b90a3022f62d7b21 (diff) | |
download | bitcoin-cc434cbf583ec8d1b0f3aa504417231fdc81f33a.tar.xz |
wallet: fix sendall creates tx that fails tx-size check
The `sendall` RPC doesn't use `CreateTransactionInternal`as the rest of
the wallet RPCs and it never checks against the tx-size mempool limit.
Add a check for tx-size as well as test coverage for that case.
Diffstat (limited to 'src/wallet/rpc')
-rw-r--r-- | src/wallet/rpc/spend.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index 68e392790a..e38b13624c 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -1414,6 +1414,11 @@ RPCHelpMan sendall() } } + // If this transaction is too large, e.g. because the wallet has many UTXOs, it will be rejected by the node's mempool. + if (tx_size.weight > MAX_STANDARD_TX_WEIGHT) { + throw JSONRPCError(RPC_WALLET_ERROR, "Transaction too large."); + } + CAmount output_amounts_claimed{0}; for (const CTxOut& out : rawTx.vout) { output_amounts_claimed += out.nValue; |