aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-08-14 12:04:47 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-08-14 16:28:37 +0200
commitddd8d80c63182aefea56abf743bb9199d9602544 (patch)
tree4cb40e3bc509c433388bf8c58dee9e3f6b86c046 /src/wallet/rpcwallet.cpp
parent87f37e259d6deb52ee464edde7aece687eea97a5 (diff)
parentd04285430d1b54b3ce3d50ffa67b6098157e7c14 (diff)
downloadbitcoin-ddd8d80c63182aefea56abf743bb9199d9602544.tar.xz
Merge pull request #6415
d042854 SQUASH "Implement watchonly support in fundrawtransaction" (Matt Corallo) 428a898 SQUASH "Add have-pubkey distinction to ISMINE flags" (Matt Corallo) 6bdb474 Implement watchonly support in fundrawtransaction (Matt Corallo) f5813bd Add logic to track pubkeys as watch-only, not just scripts (Matt Corallo) d3354c5 Add have-pubkey distinction to ISMINE flags (Matt Corallo) 5c17059 Update importaddress help to push its use to script-only (Matt Corallo) a1d7df3 Add importpubkey method to import a watch-only pubkey (Matt Corallo) 907a425 Add p2sh option to importaddress to import redeemScripts (Matt Corallo) 983d2d9 Split up importaddress into helper functions (Matt Corallo) cfc3dd3 Also remove pay-2-pubkey from watch when adding a priv key (Matt Corallo)
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 198b5baf60..bd16da7614 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -2368,15 +2368,20 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
- if (fHelp || params.size() != 1)
+ if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
- "fundrawtransaction \"hexstring\"\n"
+ "fundrawtransaction \"hexstring\" includeWatching\n"
"\nAdd inputs to a transaction until it has enough in value to meet its out value.\n"
"This will not modify existing inputs, and will add one change output to the outputs.\n"
"Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.\n"
"The inputs added will not be signed, use signrawtransaction for that.\n"
+ "Note that all existing inputs must have their previous output transaction be in the wallet.\n"
+ "Note that all inputs selected must be of standard form and P2SH scripts must be"
+ "in the wallet using importaddress or addmultisigaddress (to calculate fees).\n"
+ "Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n"
"\nArguments:\n"
- "1. \"hexstring\" (string, required) The hex string of the raw transaction\n"
+ "1. \"hexstring\" (string, required) The hex string of the raw transaction\n"
+ "2. includeWatching (boolean, optional, default false) Also select inputs which are watch only\n"
"\nResult:\n"
"{\n"
" \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n"
@@ -2395,18 +2400,22 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
+ HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"")
);
- RPCTypeCheck(params, boost::assign::list_of(UniValue::VSTR));
+ RPCTypeCheck(params, boost::assign::list_of(UniValue::VSTR)(UniValue::VBOOL));
// parse hex string from parameter
CTransaction origTx;
if (!DecodeHexTx(origTx, params[0].get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
+ bool includeWatching = false;
+ if (params.size() > 1)
+ includeWatching = true;
+
CMutableTransaction tx(origTx);
CAmount nFee;
string strFailReason;
int nChangePos = -1;
- if(!pwalletMain->FundTransaction(tx, nFee, nChangePos, strFailReason))
+ if(!pwalletMain->FundTransaction(tx, nFee, nChangePos, strFailReason, includeWatching))
throw JSONRPCError(RPC_INTERNAL_ERROR, strFailReason);
UniValue result(UniValue::VOBJ);