mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-26 08:51:55 +02:00
scripted-diff: rename gbt_force and gbt_force_name
The term "force" is ambiguous and not used in BIP9 where the ! rule prefix is introduced. Additionally, #29039 renamed gbt_vb_name to gbt_force_name which might increase the confusion. -BEGIN VERIFY SCRIPT- sed -i s/gbt_force_name/gbt_rule_value/g ./src/rpc/mining.cpp sed -i s/gbt_force/gbt_optional_rule/g $(git grep -l gbt_force) -END VERIFY SCRIPT-
This commit is contained in:
parent
14b8dfb2bd
commit
5e87c3ec09
@ -11,11 +11,11 @@
|
|||||||
const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo{
|
const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo{
|
||||||
VBDeploymentInfo{
|
VBDeploymentInfo{
|
||||||
.name = "testdummy",
|
.name = "testdummy",
|
||||||
.gbt_force = true,
|
.gbt_optional_rule = true,
|
||||||
},
|
},
|
||||||
VBDeploymentInfo{
|
VBDeploymentInfo{
|
||||||
.name = "taproot",
|
.name = "taproot",
|
||||||
.gbt_force = true,
|
.gbt_optional_rule = true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ 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 */
|
||||||
bool gbt_force;
|
bool gbt_optional_rule;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo;
|
extern const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo;
|
||||||
|
@ -596,10 +596,10 @@ static UniValue BIP22ValidationResult(const BlockValidationState& state)
|
|||||||
return "valid?";
|
return "valid?";
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string gbt_force_name(const std::string& name, bool gbt_force)
|
static std::string gbt_rule_value(const std::string& name, bool gbt_optional_rule)
|
||||||
{
|
{
|
||||||
std::string s{name};
|
std::string s{name};
|
||||||
if (!gbt_force) {
|
if (!gbt_optional_rule) {
|
||||||
s.insert(s.begin(), '!');
|
s.insert(s.begin(), '!');
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
@ -955,8 +955,8 @@ static RPCHelpMan getblocktemplate()
|
|||||||
const auto gbtstatus = chainman.m_versionbitscache.GBTStatus(*pindexPrev, consensusParams);
|
const auto gbtstatus = chainman.m_versionbitscache.GBTStatus(*pindexPrev, consensusParams);
|
||||||
|
|
||||||
for (const auto& [name, info] : gbtstatus.signalling) {
|
for (const auto& [name, info] : gbtstatus.signalling) {
|
||||||
vbavailable.pushKV(gbt_force_name(name, info.gbt_force), info.bit);
|
vbavailable.pushKV(gbt_rule_value(name, info.gbt_optional_rule), info.bit);
|
||||||
if (!info.gbt_force && !setClientRules.count(name)) {
|
if (!info.gbt_optional_rule && !setClientRules.count(name)) {
|
||||||
// If the client doesn't support this, don't indicate it in the [default] version
|
// If the client doesn't support this, don't indicate it in the [default] version
|
||||||
block.nVersion &= ~info.mask;
|
block.nVersion &= ~info.mask;
|
||||||
}
|
}
|
||||||
@ -964,16 +964,16 @@ static RPCHelpMan getblocktemplate()
|
|||||||
|
|
||||||
for (const auto& [name, info] : gbtstatus.locked_in) {
|
for (const auto& [name, info] : gbtstatus.locked_in) {
|
||||||
block.nVersion |= info.mask;
|
block.nVersion |= info.mask;
|
||||||
vbavailable.pushKV(gbt_force_name(name, info.gbt_force), info.bit);
|
vbavailable.pushKV(gbt_rule_value(name, info.gbt_optional_rule), info.bit);
|
||||||
if (!info.gbt_force && !setClientRules.count(name)) {
|
if (!info.gbt_optional_rule && !setClientRules.count(name)) {
|
||||||
// If the client doesn't support this, don't indicate it in the [default] version
|
// If the client doesn't support this, don't indicate it in the [default] version
|
||||||
block.nVersion &= ~info.mask;
|
block.nVersion &= ~info.mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& [name, info] : gbtstatus.active) {
|
for (const auto& [name, info] : gbtstatus.active) {
|
||||||
aRules.push_back(gbt_force_name(name, info.gbt_force));
|
aRules.push_back(gbt_rule_value(name, info.gbt_optional_rule));
|
||||||
if (!info.gbt_force && !setClientRules.count(name)) {
|
if (!info.gbt_optional_rule && !setClientRules.count(name)) {
|
||||||
// Not supported by the client; make sure it's safe to proceed
|
// Not supported by the client; make sure it's safe to proceed
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Support for '%s' rule requires explicit client support", name));
|
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Support for '%s' rule requires explicit client support", name));
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ BIP9GBTStatus VersionBitsCache::GBTStatus(const CBlockIndex& block_index, const
|
|||||||
VersionBitsConditionChecker checker(params, pos);
|
VersionBitsConditionChecker checker(params, pos);
|
||||||
ThresholdState state = checker.GetStateFor(&block_index, m_caches[pos]);
|
ThresholdState state = checker.GetStateFor(&block_index, m_caches[pos]);
|
||||||
const VBDeploymentInfo& vbdepinfo = VersionBitsDeploymentInfo[pos];
|
const VBDeploymentInfo& vbdepinfo = VersionBitsDeploymentInfo[pos];
|
||||||
BIP9GBTStatus::Info gbtinfo{.bit=params.vDeployments[pos].bit, .mask=checker.Mask(), .gbt_force=vbdepinfo.gbt_force};
|
BIP9GBTStatus::Info gbtinfo{.bit=params.vDeployments[pos].bit, .mask=checker.Mask(), .gbt_optional_rule=vbdepinfo.gbt_optional_rule};
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case DEFINED:
|
case DEFINED:
|
||||||
|
@ -66,7 +66,7 @@ struct BIP9GBTStatus {
|
|||||||
struct Info {
|
struct Info {
|
||||||
int bit;
|
int bit;
|
||||||
uint32_t mask;
|
uint32_t mask;
|
||||||
bool gbt_force;
|
bool gbt_optional_rule;
|
||||||
};
|
};
|
||||||
std::map<std::string, const Info, std::less<>> signalling, locked_in, active;
|
std::map<std::string, const Info, std::less<>> signalling, locked_in, active;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user