Bitcoin ABC 0.30.5
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#include <util/fs.h>
11#include <validation.h>
12
13#include <univalue.h>
14
15#include <any>
16
17class CBlock;
18class CBlockIndex;
19class Chainstate;
20class RPCHelpMan;
21namespace node {
22struct NodeContext;
23} // namespace node
24
26
33double GetDifficulty(const CBlockIndex *blockindex);
34
36void RPCNotifyBlockChange(const CBlockIndex *pindex);
37
39UniValue blockToJSON(node::BlockManager &blockman, const CBlock &block,
40 const CBlockIndex *tip, const CBlockIndex *blockindex,
41 bool txDetails = false) LOCKS_EXCLUDED(cs_main);
42
45 const CBlockIndex *blockindex)
47
52UniValue CreateUTXOSnapshot(node::NodeContext &node, Chainstate &chainstate,
53 AutoFile &afile, const fs::path &path,
54 const fs::path &tmppath);
55
56#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:165
double GetDifficulty(const CBlockIndex *blockindex)
Get the required difficulty of the next block w/r/t the given block index.
Definition: blockchain.cpp:70
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.
UniValue blockheaderToJSON(const CBlockIndex *tip, const CBlockIndex *blockindex) LOCKS_EXCLUDED(cs_main)
Block header to JSON.
Definition: blockchain.cpp:131
void RPCNotifyBlockChange(const CBlockIndex *pindex)
Callback for when block tip changed.
Definition: blockchain.cpp:234
Non-refcounted RAII wrapper for FILE*.
Definition: streams.h:528
Definition: block.h:60
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:25
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:699
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
Definition: blockstorage.h:74
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
Definition: cs_main.cpp:7
Filesystem operations and types.
Definition: fs.h:20
Definition: init.h:28
#define LOCKS_EXCLUDED(...)
Definition: threadsafety.h:55