Bitcoin ABC 0.30.7
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 <cstdint>
11#include <optional>
12
13class CBlockIndex;
14
15namespace Consensus {
16struct Params;
17}
18
20static constexpr bool DEFAULT_ENABLE_RTT{true};
21
22class RTTPolicy : public ParkingPolicy {
23private:
26
27public:
28 RTTPolicy(const Consensus::Params &consensusParams,
29 const CBlockIndex &blockIndex)
30 : m_consensusParams(consensusParams), m_blockIndex(blockIndex) {}
31
32 bool operator()(BlockPolicyValidationState &state) override;
33};
34
38std::optional<uint32_t>
39GetNextRTTWorkRequired(const CBlockIndex *pprev, int64_t now,
40 const Consensus::Params &consensusParams);
41
43bool isRTTEnabled(const Consensus::Params &params, const CBlockIndex *pprev);
44
45#endif // BITCOIN_POLICY_BLOCK_RTT_H
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:19
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:25
Definition: rtt.h:22
RTTPolicy(const Consensus::Params &consensusParams, const CBlockIndex &blockIndex)
Definition: rtt.h:28
const Consensus::Params & m_consensusParams
Definition: rtt.h:24
bool operator()(BlockPolicyValidationState &state) override
Definition: rtt.cpp:21
const CBlockIndex & m_blockIndex
Definition: rtt.h:25
static constexpr bool DEFAULT_ENABLE_RTT
Default for -enablertt.
Definition: rtt.h:20
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:102
bool isRTTEnabled(const Consensus::Params &params, const CBlockIndex *pprev)
Whether the RTT feature is enabled.
Definition: rtt.cpp:150
Parameters that influence chain consensus.
Definition: params.h:34