Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/misc.cpp
// Copyright (c) 2010 Satoshi Nakamoto | // Copyright (c) 2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "rpc/misc.h" | #include "rpc/misc.h" | ||||
#include "base58.h" | #include "base58.h" | ||||
#include "clientversion.h" | #include "clientversion.h" | ||||
#include "config.h" | #include "config.h" | ||||
#include "init.h" | #include "init.h" | ||||
#include "net.h" | #include "net.h" | ||||
#include "netbase.h" | #include "netbase.h" | ||||
#include "rpc/blockchain.h" | |||||
#include "rpc/server.h" | #include "rpc/server.h" | ||||
#include "timedata.h" | #include "timedata.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "utilstrencodings.h" | #include "utilstrencodings.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
#include "wallet/wallet.h" | #include "wallet/wallet.h" | ||||
#include "wallet/walletdb.h" | #include "wallet/walletdb.h" | ||||
#endif | #endif | ||||
#include <cstdint> | |||||
#include <univalue.h> | #include <univalue.h> | ||||
#include <cstdint> | |||||
/** | /** | ||||
* @note Do not add or change anything in the information returned by this | * @note Do not add or change anything in the information returned by this | ||||
* method. `getinfo` exists for backwards-compatibility only. It combines | * method. `getinfo` exists for backwards-compatibility only. It combines | ||||
* information from wildly different sources in the program, which is a mess, | * information from wildly different sources in the program, which is a mess, | ||||
* and is thus planned to be deprecated eventually. | * and is thus planned to be deprecated eventually. | ||||
* | * | ||||
* Based on the source of the information, new information should be added to: | * Based on the source of the information, new information should be added to: | ||||
* - `getblockchaininfo`, | * - `getblockchaininfo`, | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
obj.push_back(Pair("blocks", (int)chainActive.Height())); | obj.push_back(Pair("blocks", (int)chainActive.Height())); | ||||
obj.push_back(Pair("timeoffset", GetTimeOffset())); | obj.push_back(Pair("timeoffset", GetTimeOffset())); | ||||
if (g_connman) | if (g_connman) | ||||
obj.push_back(Pair("connections", (int)g_connman->GetNodeCount( | obj.push_back(Pair("connections", (int)g_connman->GetNodeCount( | ||||
CConnman::CONNECTIONS_ALL))); | CConnman::CONNECTIONS_ALL))); | ||||
obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() | obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() | ||||
: std::string()))); | : std::string()))); | ||||
obj.push_back(Pair("difficulty", (double)GetDifficulty())); | obj.push_back(Pair("difficulty", double(GetDifficulty(chainActive.Tip())))); | ||||
obj.push_back(Pair("testnet", Params().NetworkIDString() == | obj.push_back(Pair("testnet", Params().NetworkIDString() == | ||||
CBaseChainParams::TESTNET)); | CBaseChainParams::TESTNET)); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
if (pwalletMain) { | if (pwalletMain) { | ||||
obj.push_back( | obj.push_back( | ||||
Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime())); | Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime())); | ||||
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); | obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 488 Lines • Show Last 20 Lines |