Bitcoin
|
#include <arith_uint256.h>
#include <consensus/params.h>
#include <flatfile.h>
#include <primitives/block.h>
#include <tinyformat.h>
#include <uint256.h>
#include <vector>
Go to the source code of this file.
Classes | |
class | CBlockFileInfo |
class | CBlockIndex |
class | CDiskBlockIndex |
class | CChain |
Enumerations | |
enum | BlockStatus : uint32_t { BLOCK_VALID_UNKNOWN = 0, BLOCK_VALID_HEADER = 1, BLOCK_VALID_TREE = 2, BLOCK_VALID_TRANSACTIONS = 3, BLOCK_VALID_CHAIN = 4, BLOCK_VALID_SCRIPTS = 5, BLOCK_VALID_MASK, BLOCK_HAVE_DATA = 8, BLOCK_HAVE_UNDO = 16, BLOCK_HAVE_MASK = BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO, BLOCK_FAILED_VALID = 32, BLOCK_FAILED_CHILD = 64, BLOCK_FAILED_MASK = BLOCK_FAILED_VALID | BLOCK_FAILED_CHILD, BLOCK_OPT_WITNESS = 128 } |
Functions | |
arith_uint256 | GetBlockProof (const CBlockIndex &block) |
int64_t | GetBlockProofEquivalentTime (const CBlockIndex &to, const CBlockIndex &from, const CBlockIndex &tip, const Consensus::Params &) |
const CBlockIndex * | LastCommonAncestor (const CBlockIndex *pa, const CBlockIndex *pb) |
Variables | |
static constexpr int64_t | MAX_FUTURE_BLOCK_TIME = 2 * 60 * 60 |
static constexpr int64_t | TIMESTAMP_WINDOW = MAX_FUTURE_BLOCK_TIME |
static constexpr int64_t | MAX_BLOCK_TIME_GAP = 90 * 60 |
enum BlockStatus : uint32_t |
Enumerator | |
---|---|
BLOCK_VALID_UNKNOWN | Unused. |
BLOCK_VALID_HEADER | Parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future. |
BLOCK_VALID_TREE | All parent headers found, difficulty matches, timestamp >= median previous, checkpoint. Implies all parents are also at least TREE. |
BLOCK_VALID_TRANSACTIONS | Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid, no duplicate txids, sigops, size, merkle root. Implies all parents are at least TREE but not necessarily TRANSACTIONS. When all parent blocks also have TRANSACTIONS, CBlockIndex::nChainTx will be set. |
BLOCK_VALID_CHAIN | Outputs do not overspend inputs, no double spends, coinbase output ok, no immature coinbase spends, BIP30. Implies all parents are also at least CHAIN. |
BLOCK_VALID_SCRIPTS | Scripts & signatures ok. Implies all parents are also at least SCRIPTS. |
BLOCK_VALID_MASK | All validity bits. |
BLOCK_HAVE_DATA | full block available in blk*.dat |
BLOCK_HAVE_UNDO | undo data available in rev*.dat |
BLOCK_HAVE_MASK | |
BLOCK_FAILED_VALID | stage after last reached validness failed |
BLOCK_FAILED_CHILD | descends from failed block |
BLOCK_FAILED_MASK | |
BLOCK_OPT_WITNESS | block data in blk*.data was received with a witness-enforcing client |
arith_uint256 GetBlockProof | ( | const CBlockIndex & | block | ) |
int64_t GetBlockProofEquivalentTime | ( | const CBlockIndex & | to, |
const CBlockIndex & | from, | ||
const CBlockIndex & | tip, | ||
const Consensus::Params & | |||
) |
Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds.
const CBlockIndex* LastCommonAncestor | ( | const CBlockIndex * | pa, |
const CBlockIndex * | pb | ||
) |
Find the forking point between two chain tips.
Find the last common ancestor two blocks have. Both pa and pb must be non-nullptr.
|
static |
Maximum gap between node time and block time used for the "Catching up..." mode in GUI.
|
static |
Maximum amount of time that a block timestamp is allowed to exceed the current network-adjusted time before the block will be accepted.
|
static |
Timestamp window used as a grace period by code that compares external timestamps (such as timestamps passed to RPCs, or wallet key creation times) to block timestamps. This should be set at least as high as MAX_FUTURE_BLOCK_TIME.