diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/src/rest.cpp b/src/rest.cpp --- a/src/rest.cpp +++ b/src/rest.cpp @@ -62,9 +62,6 @@ } }; -extern UniValue mempoolInfoToJSON(); -extern UniValue mempoolToJSON(bool fVerbose = false); - static bool RESTERR(HTTPRequest *req, enum HTTPStatusCode status, std::string message) { req->WriteHeader("Content-Type", "text/plain"); diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h --- a/src/rpc/blockchain.h +++ b/src/rpc/blockchain.h @@ -14,11 +14,29 @@ UniValue getblockchaininfo(const Config &config, const JSONRPCRequest &request); +/** + * Get the difficulty of the net wrt the given block index, or the chain tip + * if not provided. + * + * @return A floating point number that is a multiple of the main net minimum + * difficulty (4295032833 hashes). + */ double GetDifficulty(const CBlockIndex *blockindex); +/** Callback for when block tip changed. */ +void RPCNotifyBlockChange(bool ibd, const CBlockIndex *pindex); + +/** Block description to JSON */ UniValue blockToJSON(const Config &config, const CBlock &block, const CBlockIndex *blockindex, bool txDetails = false); +/** Mempool information to JSON */ +UniValue mempoolInfoToJSON(); + +/** Mempool to JSON */ +UniValue mempoolToJSON(bool fVerbose = false); + +/** Block header to JSON */ UniValue blockheaderToJSON(const CBlockIndex *blockindex); #endif // BITCOIN_RPCBLOCKCHAIN_H diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -471,7 +471,7 @@ info.pushKV("depends", depends); } -UniValue mempoolToJSON(bool fVerbose = false) { +UniValue mempoolToJSON(bool fVerbose) { if (fVerbose) { LOCK(g_mempool.cs); UniValue o(UniValue::VOBJ); diff --git a/src/rpc/server.h b/src/rpc/server.h --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -281,7 +281,6 @@ void StopRPC(); std::string JSONRPCExecBatch(Config &config, RPCServer &rpcServer, const JSONRPCRequest &req, const UniValue &vReq); -void RPCNotifyBlockChange(bool ibd, const CBlockIndex *); /** * Retrieves any serialization flags requested in command line argument