Bitcoin ABC 0.32.4
P2P Digital Currency
rtt.h
Go to the documentation of this file.
1// Copyright (c) 2024 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_POLICY_BLOCK_RTT_H
6#define BITCOIN_POLICY_BLOCK_RTT_H
7
9
10#include <cstddef>
11#include <cstdint>
12#include <optional>
13#include <vector>
14
15class CBlockIndex;
16
17namespace Consensus {
18struct Params;
19}
20
22static constexpr bool DEFAULT_ENABLE_RTT{true};
23
24class RTTPolicy : public ParkingPolicy {
25private:
28
29public:
30 RTTPolicy(const Consensus::Params &consensusParams,
31 const CBlockIndex &blockIndex)
32 : m_consensusParams(consensusParams), m_blockIndex(blockIndex) {}
33
34 bool operator()(BlockPolicyValidationState &state) override;
35};
36
40std::optional<uint32_t>
41GetNextRTTWorkRequired(const CBlockIndex *pprev, int64_t now,
42 const Consensus::Params &consensusParams);
43
45bool isRTTEnabled(const Consensus::Params &params, const CBlockIndex *pprev);
46
47#endif // BITCOIN_POLICY_BLOCK_RTT_H
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:21
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:25
Definition: rtt.h:24
RTTPolicy(const Consensus::Params &consensusParams, const CBlockIndex &blockIndex)
Definition: rtt.h:30
const Consensus::Params & m_consensusParams
Definition: rtt.h:26
bool operator()(BlockPolicyValidationState &state) override
Definition: rtt.cpp:21
const CBlockIndex & m_blockIndex
Definition: rtt.h:27
static constexpr bool DEFAULT_ENABLE_RTT
Default for -enablertt.
Definition: rtt.h:22
std::optional< uint32_t > GetNextRTTWorkRequired(const CBlockIndex *pprev, int64_t now, const Consensus::Params &consensusParams)
Compute the real time block hash target given the previous block parameters.
Definition: rtt.cpp:117
bool isRTTEnabled(const Consensus::Params &params, const CBlockIndex *pprev)
Whether the RTT feature is enabled.
Definition: rtt.cpp:165
Parameters that influence chain consensus.
Definition: params.h:34