mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-06 10:42:46 +01:00
Removed main.h dependency from rpcserver.cpp
Rebased by @laanwj:
- update for RPC methods added since 84d13ee: setmocktime,
invalidateblock, reconsiderblock. Only the first, setmocktime, required a change,
the other two are thread safe.
This commit is contained in:
committed by
Wladimir J. van der Laan
parent
6b5f5294bb
commit
4401b2d7c5
@@ -169,6 +169,8 @@ Value getrawtransaction(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getrawtransaction", "\"mytxid\", 1")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
uint256 hash = ParseHashV(params[0], "parameter 1");
|
||||
|
||||
bool fVerbose = false;
|
||||
@@ -256,6 +258,7 @@ Value listunspent(const Array& params, bool fHelp)
|
||||
Array results;
|
||||
vector<COutput> vecOutputs;
|
||||
assert(pwalletMain != NULL);
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pwalletMain->AvailableCoins(vecOutputs, false);
|
||||
BOOST_FOREACH(const COutput& out, vecOutputs) {
|
||||
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
|
||||
@@ -334,6 +337,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
RPCTypeCheck(params, boost::assign::list_of(array_type)(obj_type));
|
||||
|
||||
Array inputs = params[0].get_array();
|
||||
@@ -428,6 +432,7 @@ Value decoderawtransaction(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("decoderawtransaction", "\"hexstring\"")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
RPCTypeCheck(params, boost::assign::list_of(str_type));
|
||||
|
||||
CTransaction tx;
|
||||
@@ -466,6 +471,7 @@ Value decodescript(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("decodescript", "\"hexstring\"")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
RPCTypeCheck(params, boost::assign::list_of(str_type));
|
||||
|
||||
Object r;
|
||||
@@ -532,6 +538,11 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("signrawtransaction", "\"myhex\"")
|
||||
);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
|
||||
#else
|
||||
LOCK(cs_main);
|
||||
#endif
|
||||
RPCTypeCheck(params, boost::assign::list_of(str_type)(array_type)(array_type)(str_type), true);
|
||||
|
||||
vector<unsigned char> txData(ParseHexV(params[0], "argument 1"));
|
||||
@@ -591,7 +602,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
||||
}
|
||||
}
|
||||
#ifdef ENABLE_WALLET
|
||||
else
|
||||
else if (pwalletMain)
|
||||
EnsureWalletIsUnlocked();
|
||||
#endif
|
||||
|
||||
@@ -722,6 +733,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("sendrawtransaction", "\"signedhex\"")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
RPCTypeCheck(params, boost::assign::list_of(str_type)(bool_type));
|
||||
|
||||
// parse hex string from parameter
|
||||
|
||||
Reference in New Issue
Block a user