diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index 8ea51e65c7897b..b1be59983ed0ad 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -1369,6 +1369,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"} @@ -1564,8 +1565,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 1d308c225d90b1..e1594d056be508 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