Bitcoin ABC 0.32.6
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 <core_io.h>
9#include <streams.h>
10#include <sync.h>
11#include <util/fs.h>
12#include <validation.h>
13
14#include <univalue.h>
15
16#include <any>
17
18class CBlock;
19class CBlockIndex;
20class Chainstate;
21class RPCHelpMan;
22namespace node {
23class BlockManager;
24struct NodeContext;
25} // namespace node
26
28
35double GetDifficulty(const CBlockIndex &blockindex);
36
38void RPCNotifyBlockChange(const CBlockIndex *pindex);
39
41UniValue blockToJSON(node::BlockManager &blockman, const CBlock &block,
42 const CBlockIndex &tip, const CBlockIndex &blockindex,
44
47 const CBlockIndex &blockindex)
49
56 AutoFile &afile, const fs::path &path,
57 const fs::path &tmppath);
58
61std::optional<int> GetPruneHeight(const node::BlockManager &blockman,
62 const CChain &chain)
64
65#endif // BITCOIN_RPC_BLOCKCHAIN_H
std::optional< int > GetPruneHeight(const BlockManager &blockman, const CChain &chain)
Definition: blockchain.cpp:851
UniValue blockToJSON(node::BlockManager &blockman, const CBlock &block, const CBlockIndex &tip, const CBlockIndex &blockindex, TxVerbosity verbosity) LOCKS_EXCLUDED(cs_main)
Block description to JSON.
Definition: blockchain.cpp:180
double GetDifficulty(const CBlockIndex &blockindex)
Get the required difficulty of the next block w/r/t the given block index.
Definition: blockchain.cpp:87
RPCHelpMan getblockchaininfo()
UniValue CreateUTXOSnapshot(node::NodeContext &node, Chainstate &chainstate, AutoFile &afile, const fs::path &path, const fs::path &tmppath)
Test-only 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:146
void RPCNotifyBlockChange(const CBlockIndex *pindex)
Callback for when block tip changed.
Definition: blockchain.cpp:255
Non-refcounted RAII wrapper for FILE*.
Definition: streams.h:430
Definition: block.h:60
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:25
An in-memory indexed chain of blocks.
Definition: chain.h:138
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:733
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Definition: fs.h:30
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
Definition: blockstorage.h:116
TxVerbosity
Verbose level for block's transaction.
Definition: core_io.h:29
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
Definition: cs_main.cpp:7
Definition: init.h:31
NodeContext struct containing references to chain state and connection state.
Definition: context.h:48
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:56
#define LOCKS_EXCLUDED(...)
Definition: threadsafety.h:55