Bitcoin ABC  0.26.3
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 <streams.h>
9 #include <sync.h>
10 
11 #include <univalue.h>
12 
13 #include <any>
14 
15 class CBlock;
16 class CBlockIndex;
17 class CChainState;
18 class ChainstateManager;
19 class CTxMemPool;
20 class RPCHelpMan;
21 struct NodeContext;
22 
23 extern RecursiveMutex cs_main;
24 
26 
33 double GetDifficulty(const CBlockIndex *blockindex);
34 
36 void RPCNotifyBlockChange(const CBlockIndex *pindex);
37 
39 UniValue blockToJSON(const CBlock &block, const CBlockIndex *tip,
40  const CBlockIndex *blockindex, bool txDetails = false)
42 
45 
47 UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose = false,
48  bool include_mempool_sequence = false);
49 
52  const CBlockIndex *blockindex)
54 
60  CAutoFile &afile);
61 
62 #endif // BITCOIN_RPC_BLOCKCHAIN_H
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:157
double GetDifficulty(const CBlockIndex *blockindex)
Get the required difficulty of the next block w/r/t the given block index.
Definition: blockchain.cpp:62
UniValue MempoolInfoToJSON(const CTxMemPool &pool)
Mempool information to JSON.
RPCHelpMan getblockchaininfo()
RecursiveMutex cs_main
Global state.
Definition: validation.cpp:94
UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose=false, bool include_mempool_sequence=false)
Mempool to JSON.
Definition: blockchain.cpp:589
UniValue blockheaderToJSON(const CBlockIndex *tip, const CBlockIndex *blockindex) LOCKS_EXCLUDED(cs_main)
Block header to JSON.
Definition: blockchain.cpp:123
UniValue CreateUTXOSnapshot(NodeContext &node, CChainState &chainstate, CAutoFile &afile)
Helper to create UTXO snapshots given a chainstate and a file handle.
void RPCNotifyBlockChange(const CBlockIndex *pindex)
Callback for when block tip changed.
Definition: blockchain.cpp:246
Non-refcounted RAII wrapper for FILE*.
Definition: streams.h:581
Definition: block.h:55
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:23
CChainState stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:662
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:442
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:1075
NodeContext struct containing references to chain state and connection state.
Definition: context.h:37
#define LOCKS_EXCLUDED(...)
Definition: threadsafety.h:55