diff options
author | Eric Lombrozo <elombrozo@gmail.com> | 2014-10-19 04:46:17 -0400 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-01-28 07:41:54 +0100 |
commit | 4401b2d7c52e0f3841225369fb0d10767c51aaa2 (patch) | |
tree | 29b0b989569f1a16cba69c287a30e0db220343b6 /src/rpcmisc.cpp | |
parent | 6b5f5294bba0448c0349ad41cd0e7e107a500b9d (diff) |
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.
Diffstat (limited to 'src/rpcmisc.cpp')
-rw-r--r-- | src/rpcmisc.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 3d647a0d2d..8d260b1cc9 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -69,6 +69,12 @@ Value getinfo(const Array& params, bool fHelp) + HelpExampleRpc("getinfo", "") ); +#ifdef ENABLE_WALLET + LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); +#else + LOCK(cs_main); +#endif + proxyType proxy; GetProxy(NET_IPV4, proxy); @@ -172,6 +178,12 @@ Value validateaddress(const Array& params, bool fHelp) + HelpExampleRpc("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"") ); +#ifdef ENABLE_WALLET + LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); +#else + LOCK(cs_main); +#endif + CBitcoinAddress address(params[0].get_str()); bool isValid = address.IsValid(); @@ -329,6 +341,8 @@ Value verifymessage(const Array& params, bool fHelp) + HelpExampleRpc("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"signature\", \"my message\"") ); + LOCK(cs_main); + string strAddress = params[0].get_str(); string strSign = params[1].get_str(); string strMessage = params[2].get_str(); @@ -372,6 +386,8 @@ Value setmocktime(const Array& params, bool fHelp) if (!Params().MineBlocksOnDemand()) throw runtime_error("setmocktime for regression testing (-regtest mode) only"); + LOCK(cs_main); + RPCTypeCheck(params, boost::assign::list_of(int_type)); SetMockTime(params[0].get_int64()); |