mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
deploymentinfo: Add DeploymentName()
This commit is contained in:
@@ -16,3 +16,21 @@ const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_B
|
|||||||
/*.gbt_force =*/ true,
|
/*.gbt_force =*/ true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string DeploymentName(Consensus::BuriedDeployment dep)
|
||||||
|
{
|
||||||
|
assert(ValidDeployment(dep));
|
||||||
|
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";
|
||||||
|
} // no default case, so the compiler can warn about missing cases
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
#ifndef BITCOIN_DEPLOYMENTINFO_H
|
#ifndef BITCOIN_DEPLOYMENTINFO_H
|
||||||
#define BITCOIN_DEPLOYMENTINFO_H
|
#define BITCOIN_DEPLOYMENTINFO_H
|
||||||
|
|
||||||
|
#include <consensus/params.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
struct VBDeploymentInfo {
|
struct VBDeploymentInfo {
|
||||||
/** Deployment name */
|
/** Deployment name */
|
||||||
const char *name;
|
const char *name;
|
||||||
@@ -12,6 +16,14 @@ struct VBDeploymentInfo {
|
|||||||
bool gbt_force;
|
bool gbt_force;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct VBDeploymentInfo VersionBitsDeploymentInfo[];
|
extern const VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS];
|
||||||
|
|
||||||
|
std::string DeploymentName(Consensus::BuriedDeployment dep);
|
||||||
|
|
||||||
|
inline std::string DeploymentName(Consensus::DeploymentPos pos)
|
||||||
|
{
|
||||||
|
assert(Consensus::ValidDeployment(pos));
|
||||||
|
return VersionBitsDeploymentInfo[pos].name;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // BITCOIN_DEPLOYMENTINFO_H
|
#endif // BITCOIN_DEPLOYMENTINFO_H
|
||||||
|
|||||||
Reference in New Issue
Block a user