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.
This commit is contained in:
kouloumos
2022-09-06 20:52:41 +03:00
parent 718304d222
commit cc434cbf58
2 changed files with 22 additions and 0 deletions

View File

@@ -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;