From eca550f2501f3f2bbe682bdc3cb8b90c90c90275 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 9 Sep 2016 05:32:12 +0000 Subject: RPC/Wallet: Pass CWallet as pointer to helper functions --- src/rpc/rawtransaction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/rpc/rawtransaction.cpp') diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index bf16f27498..faafe9829b 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -603,7 +603,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request) "The third optional argument (may be null) is an array of base58-encoded private\n" "keys that, if given, will be the only keys used to sign the transaction.\n" #ifdef ENABLE_WALLET - + HelpRequiringPassphrase() + "\n" + + HelpRequiringPassphrase(pwalletMain) + "\n" #endif "\nArguments:\n" @@ -718,7 +718,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request) } #ifdef ENABLE_WALLET else if (pwalletMain) - EnsureWalletIsUnlocked(); + EnsureWalletIsUnlocked(pwalletMain); #endif // Add previous txouts given in the RPC call: -- cgit v1.2.3 From d77ad6d41666b4c41abe1ba3b63300df1903643e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 25 Oct 2016 07:45:57 +0000 Subject: RPC: Do all wallet access through new GetWalletForJSONRPCRequest --- src/rpc/rawtransaction.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/rpc/rawtransaction.cpp') diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index faafe9829b..5c75fecac8 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -594,6 +594,10 @@ static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std:: UniValue signrawtransaction(const JSONRPCRequest& request) { +#ifdef ENABLE_WALLET + CWallet * const pwallet = GetWalletForJSONRPCRequest(request); +#endif + if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) throw runtime_error( "signrawtransaction \"hexstring\" ( [{\"txid\":\"id\",\"vout\":n,\"scriptPubKey\":\"hex\",\"redeemScript\":\"hex\"},...] [\"privatekey1\",...] sighashtype )\n" @@ -603,7 +607,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request) "The third optional argument (may be null) is an array of base58-encoded private\n" "keys that, if given, will be the only keys used to sign the transaction.\n" #ifdef ENABLE_WALLET - + HelpRequiringPassphrase(pwalletMain) + "\n" + + HelpRequiringPassphrase(pwallet) + "\n" #endif "\nArguments:\n" @@ -654,7 +658,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request) ); #ifdef ENABLE_WALLET - LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); + LOCK2(cs_main, pwallet ? &pwallet->cs_wallet : NULL); #else LOCK(cs_main); #endif @@ -717,8 +721,8 @@ UniValue signrawtransaction(const JSONRPCRequest& request) } } #ifdef ENABLE_WALLET - else if (pwalletMain) - EnsureWalletIsUnlocked(pwalletMain); + else if (pwallet) + EnsureWalletIsUnlocked(pwallet); #endif // Add previous txouts given in the RPC call: @@ -785,7 +789,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request) } #ifdef ENABLE_WALLET - const CKeyStore& keystore = ((fGivenKeys || !pwalletMain) ? tempKeystore : *pwalletMain); + const CKeyStore& keystore = ((fGivenKeys || !pwallet) ? tempKeystore : *pwallet); #else const CKeyStore& keystore = tempKeystore; #endif -- cgit v1.2.3 From bf8a04a165e1c19dffce70a7e5c3fb10b0035d96 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 25 Oct 2016 08:04:23 +0000 Subject: Reformat touched lines with C++11 --- src/rpc/rawtransaction.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/rpc/rawtransaction.cpp') diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 5c75fecac8..ce7afcbe54 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -721,8 +721,9 @@ UniValue signrawtransaction(const JSONRPCRequest& request) } } #ifdef ENABLE_WALLET - else if (pwallet) + else if (pwallet) { EnsureWalletIsUnlocked(pwallet); + } #endif // Add previous txouts given in the RPC call: -- cgit v1.2.3 From a4356328e00155796cd7aa188e96c51c09562423 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 6 Jan 2017 17:53:06 +0000 Subject: Move wallet RPC declarations to rpcwallet.h --- src/rpc/rawtransaction.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/rpc/rawtransaction.cpp') diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index ce7afcbe54..79b27d0475 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -24,6 +24,7 @@ #include "uint256.h" #include "utilstrencodings.h" #ifdef ENABLE_WALLET +#include "wallet/rpcwallet.h" #include "wallet/wallet.h" #endif -- cgit v1.2.3