mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-24 05:44:30 +00:00
Merge #10463: Names: BIP9 vs versionbits
b463bc9 scripted-diff: s/BIP9DeploymentInfo/VBDeploymentInfo/ (Jorge Timón) 29c0719 Rename -bip9params to -vbparams (shaolinfry) Tree-SHA512: a8a2bf6e24a4a7fc82f784c78c0cd92472e9ba55ce3fb22dafef3eccdcfccb2da5a6078fbeec1a8a4b6ab1f1b226976c5aba964dd5e3d029a21b109a7c044374
This commit is contained in:
commit
323a46e034
@ -55,7 +55,7 @@ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits
|
|||||||
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
|
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChainParams::UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
|
void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
|
||||||
{
|
{
|
||||||
consensus.vDeployments[d].nStartTime = nStartTime;
|
consensus.vDeployments[d].nStartTime = nStartTime;
|
||||||
consensus.vDeployments[d].nTimeout = nTimeout;
|
consensus.vDeployments[d].nTimeout = nTimeout;
|
||||||
@ -356,8 +356,7 @@ void SelectParams(const std::string& network)
|
|||||||
globalChainParams = CreateChainParams(network);
|
globalChainParams = CreateChainParams(network);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
|
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
|
||||||
{
|
{
|
||||||
globalChainParams->UpdateBIP9Parameters(d, nStartTime, nTimeout);
|
globalChainParams->UpdateVersionBitsParameters(d, nStartTime, nTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
|
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
|
||||||
const CCheckpointData& Checkpoints() const { return checkpointData; }
|
const CCheckpointData& Checkpoints() const { return checkpointData; }
|
||||||
const ChainTxData& TxData() const { return chainTxData; }
|
const ChainTxData& TxData() const { return chainTxData; }
|
||||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
|
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
|
||||||
protected:
|
protected:
|
||||||
CChainParams() {}
|
CChainParams() {}
|
||||||
|
|
||||||
@ -116,8 +116,8 @@ const CChainParams &Params();
|
|||||||
void SelectParams(const std::string& chain);
|
void SelectParams(const std::string& chain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows modifying the BIP9 regtest parameters.
|
* Allows modifying the Version Bits regtest parameters.
|
||||||
*/
|
*/
|
||||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
|
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
|
||||||
|
|
||||||
#endif // BITCOIN_CHAINPARAMS_H
|
#endif // BITCOIN_CHAINPARAMS_H
|
||||||
|
16
src/init.cpp
16
src/init.cpp
@ -449,7 +449,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||||||
strUsage += HelpMessageOpt("-limitancestorsize=<n>", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT));
|
strUsage += HelpMessageOpt("-limitancestorsize=<n>", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT));
|
||||||
strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT));
|
strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT));
|
||||||
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
|
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
|
||||||
strUsage += HelpMessageOpt("-bip9params=deployment:start:end", "Use given start/end times for specified BIP9 deployment (regtest-only)");
|
strUsage += HelpMessageOpt("-vbparams=deployment:start:end", "Use given start/end times for specified version bits deployment (regtest-only)");
|
||||||
}
|
}
|
||||||
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
||||||
_("If <category> is not supplied or if <category> = 1, output all debugging information.") + " " + _("<category> can be:") + " " + ListLogCategories() + ".");
|
_("If <category> is not supplied or if <category> = 1, output all debugging information.") + " " + _("<category> can be:") + " " + ListLogCategories() + ".");
|
||||||
@ -1104,16 +1104,16 @@ bool AppInitParameterInteraction()
|
|||||||
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end());
|
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gArgs.IsArgSet("-bip9params")) {
|
if (gArgs.IsArgSet("-vbparams")) {
|
||||||
// Allow overriding BIP9 parameters for testing
|
// Allow overriding version bits parameters for testing
|
||||||
if (!chainparams.MineBlocksOnDemand()) {
|
if (!chainparams.MineBlocksOnDemand()) {
|
||||||
return InitError("BIP9 parameters may only be overridden on regtest.");
|
return InitError("Version bits parameters may only be overridden on regtest.");
|
||||||
}
|
}
|
||||||
for (const std::string& strDeployment : gArgs.GetArgs("-bip9params")) {
|
for (const std::string& strDeployment : gArgs.GetArgs("-vbparams")) {
|
||||||
std::vector<std::string> vDeploymentParams;
|
std::vector<std::string> vDeploymentParams;
|
||||||
boost::split(vDeploymentParams, strDeployment, boost::is_any_of(":"));
|
boost::split(vDeploymentParams, strDeployment, boost::is_any_of(":"));
|
||||||
if (vDeploymentParams.size() != 3) {
|
if (vDeploymentParams.size() != 3) {
|
||||||
return InitError("BIP9 parameters malformed, expecting deployment:start:end");
|
return InitError("Version bits parameters malformed, expecting deployment:start:end");
|
||||||
}
|
}
|
||||||
int64_t nStartTime, nTimeout;
|
int64_t nStartTime, nTimeout;
|
||||||
if (!ParseInt64(vDeploymentParams[1], &nStartTime)) {
|
if (!ParseInt64(vDeploymentParams[1], &nStartTime)) {
|
||||||
@ -1126,9 +1126,9 @@ bool AppInitParameterInteraction()
|
|||||||
for (int j=0; j<(int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j)
|
for (int j=0; j<(int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j)
|
||||||
{
|
{
|
||||||
if (vDeploymentParams[0].compare(VersionBitsDeploymentInfo[j].name) == 0) {
|
if (vDeploymentParams[0].compare(VersionBitsDeploymentInfo[j].name) == 0) {
|
||||||
UpdateBIP9Parameters(Consensus::DeploymentPos(j), nStartTime, nTimeout);
|
UpdateVersionBitsParameters(Consensus::DeploymentPos(j), nStartTime, nTimeout);
|
||||||
found = true;
|
found = true;
|
||||||
LogPrintf("Setting BIP9 activation parameters for %s to start=%ld, timeout=%ld\n", vDeploymentParams[0], nStartTime, nTimeout);
|
LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld\n", vDeploymentParams[0], nStartTime, nTimeout);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ static UniValue BIP22ValidationResult(const CValidationState& state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string gbt_vb_name(const Consensus::DeploymentPos pos) {
|
std::string gbt_vb_name(const Consensus::DeploymentPos pos) {
|
||||||
const struct BIP9DeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||||
std::string s = vbinfo.name;
|
std::string s = vbinfo.name;
|
||||||
if (!vbinfo.gbt_force) {
|
if (!vbinfo.gbt_force) {
|
||||||
s.insert(s.begin(), '!');
|
s.insert(s.begin(), '!');
|
||||||
@ -515,7 +515,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||||||
// TODO: Maybe recheck connections/IBD and (if something wrong) send an expires-immediately template to stop miners?
|
// TODO: Maybe recheck connections/IBD and (if something wrong) send an expires-immediately template to stop miners?
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct BIP9DeploymentInfo& segwit_info = VersionBitsDeploymentInfo[Consensus::DEPLOYMENT_SEGWIT];
|
const struct VBDeploymentInfo& segwit_info = VersionBitsDeploymentInfo[Consensus::DEPLOYMENT_SEGWIT];
|
||||||
// If the caller is indicating segwit support, then allow CreateNewBlock()
|
// If the caller is indicating segwit support, then allow CreateNewBlock()
|
||||||
// to select witness transactions, after segwit activates (otherwise
|
// to select witness transactions, after segwit activates (otherwise
|
||||||
// don't).
|
// don't).
|
||||||
@ -629,7 +629,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||||||
// FALL THROUGH to get vbavailable set...
|
// FALL THROUGH to get vbavailable set...
|
||||||
case THRESHOLD_STARTED:
|
case THRESHOLD_STARTED:
|
||||||
{
|
{
|
||||||
const struct BIP9DeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||||
vbavailable.push_back(Pair(gbt_vb_name(pos), consensusParams.vDeployments[pos].bit));
|
vbavailable.push_back(Pair(gbt_vb_name(pos), consensusParams.vDeployments[pos].bit));
|
||||||
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
|
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
|
||||||
if (!vbinfo.gbt_force) {
|
if (!vbinfo.gbt_force) {
|
||||||
@ -642,7 +642,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||||||
case THRESHOLD_ACTIVE:
|
case THRESHOLD_ACTIVE:
|
||||||
{
|
{
|
||||||
// Add to rules only
|
// Add to rules only
|
||||||
const struct BIP9DeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||||
aRules.push_back(gbt_vb_name(pos));
|
aRules.push_back(gbt_vb_name(pos));
|
||||||
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
|
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
|
||||||
// Not supported by the client; make sure it's safe to proceed
|
// Not supported by the client; make sure it's safe to proceed
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "versionbits.h"
|
#include "versionbits.h"
|
||||||
#include "consensus/params.h"
|
#include "consensus/params.h"
|
||||||
|
|
||||||
const struct BIP9DeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
|
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
|
||||||
{
|
{
|
||||||
/*.name =*/ "testdummy",
|
/*.name =*/ "testdummy",
|
||||||
/*.gbt_force =*/ true,
|
/*.gbt_force =*/ true,
|
||||||
|
@ -30,7 +30,7 @@ enum ThresholdState {
|
|||||||
// will either be NULL or a block with (height + 1) % Period() == 0.
|
// will either be NULL or a block with (height + 1) % Period() == 0.
|
||||||
typedef std::map<const CBlockIndex*, ThresholdState> ThresholdConditionCache;
|
typedef std::map<const CBlockIndex*, ThresholdState> ThresholdConditionCache;
|
||||||
|
|
||||||
struct BIP9DeploymentInfo {
|
struct VBDeploymentInfo {
|
||||||
/** Deployment name */
|
/** Deployment name */
|
||||||
const char *name;
|
const char *name;
|
||||||
/** Whether GBT clients can safely ignore this rule in simplified usage */
|
/** Whether GBT clients can safely ignore this rule in simplified usage */
|
||||||
@ -45,7 +45,7 @@ struct BIP9Stats {
|
|||||||
bool possible;
|
bool possible;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct BIP9DeploymentInfo VersionBitsDeploymentInfo[];
|
extern const struct VBDeploymentInfo VersionBitsDeploymentInfo[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class that implements BIP9-style threshold logic, and caches results.
|
* Abstract class that implements BIP9-style threshold logic, and caches results.
|
||||||
|
@ -98,7 +98,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
|||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
# Node0 = pre-segwit, node1 = segwit-aware
|
# Node0 = pre-segwit, node1 = segwit-aware
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.extra_args = [["-bip9params=segwit:0:0"], ["-txindex"]]
|
self.extra_args = [["-vbparams=segwit:0:0"], ["-txindex"]]
|
||||||
self.utxos = []
|
self.utxos = []
|
||||||
|
|
||||||
def build_block_on_tip(self, node, segwit=False):
|
def build_block_on_tip(self, node, segwit=False):
|
||||||
|
@ -114,7 +114,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
self.extra_args = [["-whitelist=127.0.0.1"], ["-whitelist=127.0.0.1", "-acceptnonstdtxn=0"], ["-whitelist=127.0.0.1", "-bip9params=segwit:0:0"]]
|
self.extra_args = [["-whitelist=127.0.0.1"], ["-whitelist=127.0.0.1", "-acceptnonstdtxn=0"], ["-whitelist=127.0.0.1", "-vbparams=segwit:0:0"]]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.setup_nodes()
|
self.setup_nodes()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user