diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index b3cf6a893eb160..2ea809f20665a2 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -1374,6 +1374,7 @@ RPCHelpMan sendall() RPCResult::Type::OBJ, "", "", { {RPCResult::Type::BOOL, "complete", "If the transaction has a complete set of signatures"}, + {RPCResult::Type::NUM, "weight", "The resulting transaction weight in weight units"}, {RPCResult::Type::STR_HEX, "txid", /*optional=*/true, "The transaction id for the send. Only 1 transaction is created regardless of the number of addresses."}, {RPCResult::Type::STR_HEX, "hex", /*optional=*/true, "If add_to_wallet is false, the hex-encoded raw transaction with signature(s)"}, {RPCResult::Type::STR, "psbt", /*optional=*/true, "If more signatures are needed, or if add_to_wallet is false, the base64-encoded (partially) signed transaction"} @@ -1561,8 +1562,9 @@ RPCHelpMan sendall() pwallet->LockCoin(txin.prevout); } } - - return FinishTransaction(pwallet, options, rawTx); + auto result = FinishTransaction(pwallet, options, rawTx); + result.pushKV("weight", tx_size.weight); + return result; } }; } diff --git a/test/functional/wallet_sendall.py b/test/functional/wallet_sendall.py index c2b800df2189e9..adf64eeb14db1a 100755 --- a/test/functional/wallet_sendall.py +++ b/test/functional/wallet_sendall.py @@ -68,6 +68,7 @@ def test_sendall_success(self, sendall_args, remaining_balance = 0): assert_equal(remaining_balance, self.wallet.getbalances()["mine"]["trusted"]) assert_equal(sendall_tx_receipt["complete"], True) + assert_greater_than(sendall_tx_receipt["weight"], 0) return self.wallet.gettransaction(txid = sendall_tx_receipt["txid"], verbose = True) @cleanup