Skip to content

Commit 5e87c3e

Browse files
committed
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-
1 parent 14b8dfb commit 5e87c3e

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/deploymentinfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo{
1212
VBDeploymentInfo{
1313
.name = "testdummy",
14-
.gbt_force = true,
14+
.gbt_optional_rule = true,
1515
},
1616
VBDeploymentInfo{
1717
.name = "taproot",
18-
.gbt_force = true,
18+
.gbt_optional_rule = true,
1919
},
2020
};
2121

src/deploymentinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct VBDeploymentInfo {
1515
/** Deployment name */
1616
const char *name;
1717
/** Whether GBT clients can safely ignore this rule in simplified usage */
18-
bool gbt_force;
18+
bool gbt_optional_rule;
1919
};
2020

2121
extern const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo;

src/rpc/mining.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,10 @@ static UniValue BIP22ValidationResult(const BlockValidationState& state)
596596
return "valid?";
597597
}
598598

599-
static std::string gbt_force_name(const std::string& name, bool gbt_force)
599+
static std::string gbt_rule_value(const std::string& name, bool gbt_optional_rule)
600600
{
601601
std::string s{name};
602-
if (!gbt_force) {
602+
if (!gbt_optional_rule) {
603603
s.insert(s.begin(), '!');
604604
}
605605
return s;
@@ -955,25 +955,25 @@ static RPCHelpMan getblocktemplate()
955955
const auto gbtstatus = chainman.m_versionbitscache.GBTStatus(*pindexPrev, consensusParams);
956956

957957
for (const auto& [name, info] : gbtstatus.signalling) {
958-
vbavailable.pushKV(gbt_force_name(name, info.gbt_force), info.bit);
959-
if (!info.gbt_force && !setClientRules.count(name)) {
958+
vbavailable.pushKV(gbt_rule_value(name, info.gbt_optional_rule), info.bit);
959+
if (!info.gbt_optional_rule && !setClientRules.count(name)) {
960960
// If the client doesn't support this, don't indicate it in the [default] version
961961
block.nVersion &= ~info.mask;
962962
}
963963
}
964964

965965
for (const auto& [name, info] : gbtstatus.locked_in) {
966966
block.nVersion |= info.mask;
967-
vbavailable.pushKV(gbt_force_name(name, info.gbt_force), info.bit);
968-
if (!info.gbt_force && !setClientRules.count(name)) {
967+
vbavailable.pushKV(gbt_rule_value(name, info.gbt_optional_rule), info.bit);
968+
if (!info.gbt_optional_rule && !setClientRules.count(name)) {
969969
// If the client doesn't support this, don't indicate it in the [default] version
970970
block.nVersion &= ~info.mask;
971971
}
972972
}
973973

974974
for (const auto& [name, info] : gbtstatus.active) {
975-
aRules.push_back(gbt_force_name(name, info.gbt_force));
976-
if (!info.gbt_force && !setClientRules.count(name)) {
975+
aRules.push_back(gbt_rule_value(name, info.gbt_optional_rule));
976+
if (!info.gbt_optional_rule && !setClientRules.count(name)) {
977977
// Not supported by the client; make sure it's safe to proceed
978978
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Support for '%s' rule requires explicit client support", name));
979979
}

src/versionbits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ BIP9GBTStatus VersionBitsCache::GBTStatus(const CBlockIndex& block_index, const
235235
VersionBitsConditionChecker checker(params, pos);
236236
ThresholdState state = checker.GetStateFor(&block_index, m_caches[pos]);
237237
const VBDeploymentInfo& vbdepinfo = VersionBitsDeploymentInfo[pos];
238-
BIP9GBTStatus::Info gbtinfo{.bit=params.vDeployments[pos].bit, .mask=checker.Mask(), .gbt_force=vbdepinfo.gbt_force};
238+
BIP9GBTStatus::Info gbtinfo{.bit=params.vDeployments[pos].bit, .mask=checker.Mask(), .gbt_optional_rule=vbdepinfo.gbt_optional_rule};
239239

240240
switch (state) {
241241
case DEFINED:

src/versionbits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct BIP9GBTStatus {
6666
struct Info {
6767
int bit;
6868
uint32_t mask;
69-
bool gbt_force;
69+
bool gbt_optional_rule;
7070
};
7171
std::map<std::string, const Info, std::less<>> signalling, locked_in, active;
7272
};

0 commit comments

Comments
 (0)