Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
deploymentstatus.h
Go to the documentation of this file.
1
// Copyright (c) 2020-present The Bitcoin Core 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_DEPLOYMENTSTATUS_H
6
#define BITCOIN_DEPLOYMENTSTATUS_H
7
8
#include <
chain.h
>
9
#include <
versionbits.h
>
10
11
#include <limits>
12
14
inline
bool
DeploymentActiveAfter
(
const
CBlockIndex
* pindexPrev,
const
Consensus::Params
& params,
Consensus::BuriedDeployment
dep, [[maybe_unused]]
VersionBitsCache
& versionbitscache)
15
{
16
assert
(
Consensus::ValidDeployment
(dep));
17
return
(pindexPrev ==
nullptr
? 0 : pindexPrev->
nHeight
+ 1) >= params.
DeploymentHeight
(dep);
18
}
19
20
inline
bool
DeploymentActiveAfter
(
const
CBlockIndex
* pindexPrev,
const
Consensus::Params
& params,
Consensus::DeploymentPos
dep,
VersionBitsCache
& versionbitscache)
21
{
22
assert
(
Consensus::ValidDeployment
(dep));
23
return
versionbitscache.
IsActiveAfter
(pindexPrev, params, dep);
24
}
25
27
inline
bool
DeploymentActiveAt
(
const
CBlockIndex
& index,
const
Consensus::Params
& params,
Consensus::BuriedDeployment
dep, [[maybe_unused]]
VersionBitsCache
& versionbitscache)
28
{
29
assert
(
Consensus::ValidDeployment
(dep));
30
return
index.
nHeight
>= params.
DeploymentHeight
(dep);
31
}
32
33
inline
bool
DeploymentActiveAt
(
const
CBlockIndex
& index,
const
Consensus::Params
& params,
Consensus::DeploymentPos
dep,
VersionBitsCache
& versionbitscache)
34
{
35
assert
(
Consensus::ValidDeployment
(dep));
36
return
DeploymentActiveAfter
(index.
pprev
, params, dep, versionbitscache);
37
}
38
40
inline
bool
DeploymentEnabled
(
const
Consensus::Params
& params,
Consensus::BuriedDeployment
dep)
41
{
42
assert
(
Consensus::ValidDeployment
(dep));
43
return
params.
DeploymentHeight
(dep) != std::numeric_limits<int>::max();
44
}
45
46
inline
bool
DeploymentEnabled
(
const
Consensus::Params
& params,
Consensus::DeploymentPos
dep)
47
{
48
assert
(
Consensus::ValidDeployment
(dep));
49
return
params.
vDeployments
[dep].nStartTime !=
Consensus::BIP9Deployment::NEVER_ACTIVE
;
50
}
51
52
#endif
// BITCOIN_DEPLOYMENTSTATUS_H
chain.h
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition
chain.h:94
CBlockIndex::pprev
CBlockIndex * pprev
pointer to the index of the predecessor of this block
Definition
chain.h:100
CBlockIndex::nHeight
int nHeight
height of the entry in the chain. The genesis block has height 0
Definition
chain.h:106
VersionBitsCache
BIP 9 allows multiple softforks to be deployed in parallel.
Definition
versionbits.h:77
VersionBitsCache::IsActiveAfter
bool IsActiveAfter(const CBlockIndex *pindexPrev, const Consensus::Params ¶ms, Consensus::DeploymentPos pos) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Get the BIP9 state for a given deployment for the block after pindexPrev.
Definition
versionbits.cpp:259
DeploymentActiveAfter
bool DeploymentActiveAfter(const CBlockIndex *pindexPrev, const Consensus::Params ¶ms, Consensus::BuriedDeployment dep, VersionBitsCache &versionbitscache)
Determine if a deployment is active for the next block.
Definition
deploymentstatus.h:14
DeploymentEnabled
bool DeploymentEnabled(const Consensus::Params ¶ms, Consensus::BuriedDeployment dep)
Determine if a deployment is enabled (can ever be active).
Definition
deploymentstatus.h:40
DeploymentActiveAt
bool DeploymentActiveAt(const CBlockIndex &index, const Consensus::Params ¶ms, Consensus::BuriedDeployment dep, VersionBitsCache &versionbitscache)
Determine if a deployment is active for this block.
Definition
deploymentstatus.h:27
Consensus::ValidDeployment
constexpr bool ValidDeployment(BuriedDeployment dep)
Definition
params.h:32
Consensus::DeploymentPos
DeploymentPos
Definition
params.h:34
Consensus::BuriedDeployment
BuriedDeployment
A buried deployment is one where the height of the activation has been hardcoded into the client impl...
Definition
params.h:24
Consensus::BIP9Deployment::NEVER_ACTIVE
static constexpr int64_t NEVER_ACTIVE
Special value for nStartTime indicating that the deployment is never active.
Definition
params.h:78
Consensus::Params
Parameters that influence chain consensus.
Definition
params.h:84
Consensus::Params::DeploymentHeight
int DeploymentHeight(BuriedDeployment dep) const
Definition
params.h:139
Consensus::Params::vDeployments
std::array< BIP9Deployment, MAX_VERSION_BITS_DEPLOYMENTS > vDeployments
Definition
params.h:110
assert
assert(!tx.IsCoinBase())
versionbits.h
Generated on
for Bitcoin Core by
1.17.0