1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
crate::ix!();
//-------------------------------------------[.cpp/bitcoin/src/deploymentinfo.h]
pub struct VBDeploymentInfo {
/**
| Deployment name
|
*/
name: *const u8,
/**
| Whether GBT clients can safely ignore
| this rule in simplified usage
|
*/
gbt_force: bool,
}
lazy_static!{
/*
extern const VBDeploymentInfo VersionBitsDeploymentInfo[consensus::MAX_VERSION_BITS_DEPLOYMENTS];
*/
}
#[inline] pub fn deployment_name_with_deployment_pos(pos: ConsensusDeploymentPos) -> String {
todo!();
/*
assert(consensus::ValidDeployment(pos));
return VersionBitsDeploymentInfo[pos].name;
*/
}
//-------------------------------------------[.cpp/bitcoin/src/deploymentinfo.cpp]
lazy_static!{
/*
const struct VBDeploymentInfo VersionBitsDeploymentInfo[consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
{
/*.name =*/ "testdummy",
/*.gbt_force =*/ true,
},
{
/*.name =*/ "taproot",
/*.gbt_force =*/ true,
},
};
*/
}
pub fn deployment_name(dep: ConsensusBuriedDeployment) -> String {
todo!();
/*
assert(ValidDeployment(dep));
// no default case, so the compiler can
// warn about missing cases
switch (dep) {
case consensus::DEPLOYMENT_HEIGHTINCB:
return "bip34";
case consensus::DEPLOYMENT_CLTV:
return "bip65";
case consensus::DEPLOYMENT_DERSIG:
return "bip66";
case consensus::DEPLOYMENT_CSV:
return "csv";
case consensus::DEPLOYMENT_SEGWIT:
return "segwit";
}
return "";
*/
}
//-------------------------------------------[.cpp/bitcoin/src/deploymentstatus.h]
/**
| Global cache for versionbits deployment
| status
|
*/
lazy_static!{
/*
extern VersionBitsCache g_versionbitscache;
*/
}
/**
| Determine if a deployment is active
| for the next block
|
*/
#[inline] pub fn next_deployment_active_after_with_buried_deployment(
pindex_prev: *const BlockIndex,
params: &ChainConsensusParams,
dep: ConsensusBuriedDeployment) -> bool {
todo!();
/*
assert(consensus::ValidDeployment(dep));
return (pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1) >= params.DeploymentHeight(dep);
*/
}
#[inline] pub fn next_deployment_active_after_with_deployment_pos(
pindex_prev: *const BlockIndex,
params: &ChainConsensusParams,
dep: ConsensusDeploymentPos) -> bool {
todo!();
/*
assert(consensus::ValidDeployment(dep));
return ThresholdState::ACTIVE == g_versionbitscache.State(pindexPrev, params, dep);
*/
}
/**
| Determine if a deployment is enabled
| (can ever be active)
|
*/
#[inline] pub fn deployment_enabled_with_buried_deployment(
params: &ChainConsensusParams,
dep: ConsensusBuriedDeployment) -> bool {
todo!();
/*
assert(consensus::ValidDeployment(dep));
return params.DeploymentHeight(dep) != std::numeric_limits<int>::max();
*/
}
#[inline] pub fn deployment_enabled_with_deployment_pos(
params: &ChainConsensusParams,
dep: ConsensusDeploymentPos) -> bool {
todo!();
/*
assert(consensus::ValidDeployment(dep));
return params.vDeployments[dep].nStartTime != consensus::BIP9Deployment::NEVER_ACTIVE;
*/
}
//-------------------------------------------[.cpp/bitcoin/src/deploymentstatus.cpp]
lazy_static!{
/*
VersionBitsCache g_versionbitscache;
*/
}
/**
| Basic sanity checking for BuriedDeployment/DeploymentPos
| enums and
|
| ValidDeployment check
|
*/
const_assert!{
valid_deployment_with_deployment_pos(ConsensusDeploymentPos::DEPLOYMENT_TESTDUMMY)
}
/**
| sanity check of DeploymentPos failed
| (MAX value considered valid)
|
*/
const_assert!{
!valid_deployment_with_deployment_pos(ConsensusDeploymentPos::MAX_VERSION_BITS_DEPLOYMENTS)
}
/**
| sanity check of BuriedDeployment failed
| (overlaps with DeploymentPos)
|
*/
lazy_static!{//TODO: how can we check this as const?
/*
const_assert!{
!valid_deployment_with_buried_deployment(ConsensusDeploymentPos::DEPLOYMENT_TESTDUMMY as consensus::BuriedDeployment)
}
*/
}
/**
| ValidDeployment only checks upper
| bounds for ensuring validity.
|
| This checks that the lowest possible
| value or the type is also a (specific)
| valid deployment so that lower bounds
| don't need to be checked.
|
*/
pub const fn is_minimum_deployment_heightincb_for_buried_deployment() -> bool {
true//TODO uncomment the block and use to check
/*
todo!();
is_minimum::<consensus::BuriedDeployment, ConsensusDeploymentPos::DEPLOYMENT_HEIGHTINCB>()
using U = typename std::underlying_type<T>::type;
return x == std::numeric_limits<U>::min();
*/
}
pub const fn is_minimum_deployment_testdummy_for_deployment_pos() -> bool {
true//TODO uncomment the block and use to check
/*
todo!();
is_minimum::<ConsensusDeploymentPos, ConsensusDeploymentPos::DEPLOYMENT_TESTDUMMY>()
using U = typename std::underlying_type<T>::type;
return x == std::numeric_limits<U>::min();
*/
}
const_assert!{
is_minimum_deployment_heightincb_for_buried_deployment()
} //"heightincb is not minimum value for ConsensusBuriedDeployment"
const_assert!{
is_minimum_deployment_testdummy_for_deployment_pos()
} //"testdummy is not minimum value for DeploymentPos"