From 61e1eb2e1c038ef10009921d0e991b4d1f262f51 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Fri, 13 Nov 2015 15:45:29 -0500 Subject: [PATCH 1/2] Actually use includeWatching value in fundrawtransaction Previously if you called fundrawtransaction and set includeWatching to false it'd act as through you set it to true. --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d93050d98c1..0bd1303272b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2420,7 +2420,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp) bool includeWatching = false; if (params.size() > 1) - includeWatching = true; + includeWatching = params[1].get_bool(); CMutableTransaction tx(origTx); CAmount nFee; From 10953a7d3241f66ab3b2921e0825d6857f64f6f7 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Fri, 13 Nov 2015 15:52:07 -0500 Subject: [PATCH 2/2] Better error message for fundrawtransaction w/ empty vout Previously this case failed deep in Cwallet::CreateTransaction() with the error message "Transaction amounts must be positive" --- src/wallet/rpcwallet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 0bd1303272b..7b7c9b32563 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2418,6 +2418,9 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp) if (!DecodeHexTx(origTx, params[0].get_str())) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); + if (origTx.vout.size() == 0) + throw JSONRPCError(RPC_INVALID_PARAMETER, "TX must have at least one output"); + bool includeWatching = false; if (params.size() > 1) includeWatching = params[1].get_bool();