Bitcoin ABC  0.24.7
P2P Digital Currency
blockchain.h
Go to the documentation of this file.
1 // Copyright (c) 2017-2019 The Bitcoin developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_RPC_BLOCKCHAIN_H
6 #define BITCOIN_RPC_BLOCKCHAIN_H
7 
8 #include <sync.h>
9 
10 #include <univalue.h>
11 
12 class CBlock;
13 class CBlockIndex;
14 class ChainstateManager;
15 class CTxMemPool;
16 class RPCHelpMan;
17 struct NodeContext;
18 namespace util {
19 class Ref;
20 } // namespace util
21 
22 extern RecursiveMutex cs_main;
23 
25 
32 double GetDifficulty(const CBlockIndex *blockindex);
33 
35 void RPCNotifyBlockChange(const CBlockIndex *pindex);
36 
38 UniValue blockToJSON(const CBlock &block, const CBlockIndex *tip,
39  const CBlockIndex *blockindex, bool txDetails = false)
41 
44 
46 UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose = false,
47  bool include_mempool_sequence = false);
48 
51  const CBlockIndex *blockindex)
53 
54 NodeContext &EnsureNodeContext(const util::Ref &context);
55 CTxMemPool &EnsureMemPool(const util::Ref &context);
56 ChainstateManager &EnsureChainman(const util::Ref &context);
57 
58 #endif // BITCOIN_RPC_BLOCKCHAIN_H
RPCHelpMan
Definition: util.h:334
sync.h
CTxMemPool
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:495
MempoolInfoToJSON
UniValue MempoolInfoToJSON(const CTxMemPool &pool)
Mempool information to JSON.
Definition: blockchain.cpp:1800
GetDifficulty
double GetDifficulty(const CBlockIndex *blockindex)
Get the required difficulty of the next block w/r/t the given block index.
Definition: blockchain.cpp:83
blockheaderToJSON
UniValue blockheaderToJSON(const CBlockIndex *tip, const CBlockIndex *blockindex) LOCKS_EXCLUDED(cs_main)
Block header to JSON.
Definition: blockchain.cpp:112
AnnotatedMixin< std::recursive_mutex >
EnsureNodeContext
NodeContext & EnsureNodeContext(const util::Ref &context)
Definition: blockchain.cpp:56
EnsureMemPool
CTxMemPool & EnsureMemPool(const util::Ref &context)
Definition: blockchain.cpp:63
MempoolToJSON
UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose=false, bool include_mempool_sequence=false)
Mempool to JSON.
Definition: blockchain.cpp:589
UniValue
Definition: univalue.h:23
EnsureChainman
ChainstateManager & EnsureChainman(const util::Ref &context)
Definition: blockchain.cpp:72
univalue.h
ChainstateManager
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:1099
CBlock
Definition: block.h:55
LOCKS_EXCLUDED
#define LOCKS_EXCLUDED(...)
Definition: threadsafety.h:55
cs_main
RecursiveMutex cs_main
Global state.
Definition: validation.cpp:103
getblockchaininfo
RPCHelpMan getblockchaininfo()
Definition: blockchain.cpp:1495
NodeContext
NodeContext struct containing references to chain state and connection state.
Definition: context.h:36
RPCNotifyBlockChange
void RPCNotifyBlockChange(const CBlockIndex *pindex)
Callback for when block tip changed.
Definition: blockchain.cpp:247
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:23
blockToJSON
UniValue blockToJSON(const CBlock &block, const CBlockIndex *tip, const CBlockIndex *blockindex, bool txDetails=false) LOCKS_EXCLUDED(cs_main)
Block description to JSON.
Definition: blockchain.cpp:146
util
Definition: httprpc.h:13