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 <fs.h>
9 #include <streams.h>
10 #include <sync.h>
11 #include <validation.h>
12 
13 #include <univalue.h>
14 
15 #include <any>
16 
17 class CBlock;
18 class CBlockIndex;
19 class Chainstate;
20 class ChainstateManager;
21 class CTxMemPool;
22 class RPCHelpMan;
23 namespace node {
24 struct NodeContext;
25 } // namespace node
26 
27 extern RecursiveMutex cs_main;
28 
30 
37 double GetDifficulty(const CBlockIndex *blockindex);
38 
40 void RPCNotifyBlockChange(const CBlockIndex *pindex);
41 
43 UniValue blockToJSON(node::BlockManager &blockman, const CBlock &block,
44  const CBlockIndex *tip, const CBlockIndex *blockindex,
45  bool txDetails = false) LOCKS_EXCLUDED(cs_main);
46 
49 
51 UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose = false,
52  bool include_mempool_sequence = false);
53 
56  const CBlockIndex *blockindex)
58 
63 UniValue CreateUTXOSnapshot(node::NodeContext &node, Chainstate &chainstate,
64  AutoFile &afile, const fs::path &path,
65  const fs::path &tmppath);
66 
67 #endif // BITCOIN_RPC_BLOCKCHAIN_H
UniValue blockToJSON(node::BlockManager &blockman, const CBlock &block, const CBlockIndex *tip, const CBlockIndex *blockindex, bool txDetails=false) LOCKS_EXCLUDED(cs_main)
Block description to JSON.
Definition: blockchain.cpp:167
double GetDifficulty(const CBlockIndex *blockindex)
Get the required difficulty of the next block w/r/t the given block index.
Definition: blockchain.cpp:72
UniValue MempoolInfoToJSON(const CTxMemPool &pool)
Mempool information to JSON.
RPCHelpMan getblockchaininfo()
UniValue CreateUTXOSnapshot(node::NodeContext &node, Chainstate &chainstate, AutoFile &afile, const fs::path &path, const fs::path &tmppath)
Helper to create UTXO snapshots given a chainstate and a file handle.
RecursiveMutex cs_main
Global state.
Definition: validation.cpp:111
UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose=false, bool include_mempool_sequence=false)
Mempool to JSON.
Definition: blockchain.cpp:536
UniValue blockheaderToJSON(const CBlockIndex *tip, const CBlockIndex *blockindex) LOCKS_EXCLUDED(cs_main)
Block header to JSON.
Definition: blockchain.cpp:133
void RPCNotifyBlockChange(const CBlockIndex *pindex)
Callback for when block tip changed.
Definition: blockchain.cpp:236
Non-refcounted RAII wrapper for FILE*.
Definition: streams.h:545
Definition: block.h:60
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:27
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:354
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:657
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:1166
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
Definition: blockstorage.h:69
Filesystem operations and types.
Definition: fs.h:19
Definition: init.h:28
#define LOCKS_EXCLUDED(...)
Definition: threadsafety.h:55