aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkouloumos <kouloumosa@gmail.com>2022-09-06 20:52:41 +0300
committerkouloumos <kouloumosa@gmail.com>2022-09-15 13:22:19 +0300
commitcc434cbf583ec8d1b0f3aa504417231fdc81f33a (patch)
tree8946bdba3873a4dceb2162f95ed13303ba05267c /src
parent718304d222671f98d2335cd9b90a3022f62d7b21 (diff)
downloadbitcoin-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')
-rw-r--r--src/wallet/rpc/spend.cpp5
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;