diff options
author | Jeff Garzik <jgarzik@exmulti.com> | 2012-08-21 11:03:38 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2012-08-21 11:03:38 -0400 |
commit | c625ae04d2fc8f55f282afafbcabfe5185bf0969 (patch) | |
tree | 4ac5ac117e719697d1ef7ef19d845d7db9a8ae3a /src/rpcwallet.cpp | |
parent | e3bc56986508b40f894c7c707d39ea1bb437ebb5 (diff) |
RPC, cosmetic: move more RPC code to new rpcblockchain.cpp module
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r-- | src/rpcwallet.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index b9b3f52f0e..f74f3cb3ad 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -53,6 +53,37 @@ string AccountFromValue(const Value& value) return strAccount; } +Value getinfo(const Array& params, bool fHelp) +{ + if (fHelp || params.size() != 0) + throw runtime_error( + "getinfo\n" + "Returns an object containing various state info."); + + CService addrProxy; + GetProxy(NET_IPV4, addrProxy); + + Object obj; + obj.push_back(Pair("version", (int)CLIENT_VERSION)); + obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION)); + obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); + obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); + obj.push_back(Pair("blocks", (int)nBestHeight)); + obj.push_back(Pair("connections", (int)vNodes.size())); + obj.push_back(Pair("proxy", (addrProxy.IsValid() ? addrProxy.ToStringIPPort() : string()))); + obj.push_back(Pair("difficulty", (double)GetDifficulty())); + obj.push_back(Pair("testnet", fTestNet)); + obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); + obj.push_back(Pair("keypoolsize", pwalletMain->GetKeyPoolSize())); + obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); + if (pwalletMain->IsCrypted()) + obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime / 1000)); + obj.push_back(Pair("errors", GetWarnings("statusbar"))); + return obj; +} + + + Value getnewaddress(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) |