Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.h
// Copyright (c) 2017 The Bitcoin developers | // Copyright (c) 2017 The Bitcoin 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. | ||||
#ifndef BITCOIN_RPC_BLOCKCHAIN_H | #ifndef BITCOIN_RPC_BLOCKCHAIN_H | ||||
#define BITCOIN_RPC_BLOCKCHAIN_H | #define BITCOIN_RPC_BLOCKCHAIN_H | ||||
#include <univalue.h> | #include <univalue.h> | ||||
class CBlock; | class CBlock; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
class Config; | class Config; | ||||
class CTxMemPool; | |||||
class JSONRPCRequest; | class JSONRPCRequest; | ||||
UniValue getblockchaininfo(const Config &config, const JSONRPCRequest &request); | UniValue getblockchaininfo(const Config &config, const JSONRPCRequest &request); | ||||
/** | /** | ||||
* Get the required difficulty of the next block w/r/t the given block index. | * Get the required difficulty of the next block w/r/t the given block index. | ||||
* | * | ||||
* @return A floating point number that is a multiple of the main net minimum | * @return A floating point number that is a multiple of the main net minimum | ||||
* difficulty (4295032833 hashes). | * difficulty (4295032833 hashes). | ||||
*/ | */ | ||||
double GetDifficulty(const CBlockIndex *blockindex); | double GetDifficulty(const CBlockIndex *blockindex); | ||||
/** Callback for when block tip changed. */ | /** Callback for when block tip changed. */ | ||||
void RPCNotifyBlockChange(bool ibd, const CBlockIndex *pindex); | void RPCNotifyBlockChange(bool ibd, const CBlockIndex *pindex); | ||||
/** Block description to JSON */ | /** Block description to JSON */ | ||||
UniValue blockToJSON(const CBlock &block, const CBlockIndex *tip, | UniValue blockToJSON(const CBlock &block, const CBlockIndex *tip, | ||||
const CBlockIndex *blockindex, bool txDetails = false); | const CBlockIndex *blockindex, bool txDetails = false); | ||||
/** Mempool information to JSON */ | /** Mempool information to JSON */ | ||||
UniValue mempoolInfoToJSON(); | UniValue MempoolInfoToJSON(const CTxMemPool &pool); | ||||
/** Mempool to JSON */ | /** Mempool to JSON */ | ||||
UniValue mempoolToJSON(bool fVerbose = false); | UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose = false); | ||||
/** Block header to JSON */ | /** Block header to JSON */ | ||||
UniValue blockheaderToJSON(const CBlockIndex *tip, | UniValue blockheaderToJSON(const CBlockIndex *tip, | ||||
const CBlockIndex *blockindex); | const CBlockIndex *blockindex); | ||||
#endif // BITCOIN_RPC_BLOCKCHAIN_H | #endif // BITCOIN_RPC_BLOCKCHAIN_H |