Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
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
40 const CBlockIndex *tip, const CBlockIndex *blockindex,
41 bool txDetails = false) LOCKS_EXCLUDED(cs_main);
42
45 const CBlockIndex *blockindex)
47
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.
double GetDifficulty(const CBlockIndex *blockindex)
Get the required difficulty of the next block w/r/t the given block index.
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.
void RPCNotifyBlockChange(const CBlockIndex *pindex)
Callback for when block tip changed.
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:693
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
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
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
#define LOCKS_EXCLUDED(...)