Skip to content

Commit 1deba63

Browse files
authored
Merge pull request #65 from ajtowns/202408-inq28-setup
Forward port setup commits to 28.x
2 parents 557956d + 60b3c4b commit 1deba63

35 files changed

+554
-1424
lines changed

build_msvc/bitcoin_config.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues"
5454

5555
/* Define to the full name of this package. */
56-
#define PACKAGE_NAME "Bitcoin Core"
56+
#define PACKAGE_NAME "Bitcoin Inquisition"
5757

5858
/* Define to the full name and version of this package. */
5959
#define PACKAGE_STRING $

build_msvc/bitcoind/bitcoind.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<Target Name="AfterBuild">
5757
<Copy SourceFiles="$(ConfigIniIn)" DestinationFiles="$(ConfigIniOut)" ></Copy>
5858
<ReplaceInFile FilePath="$(ConfigIniOut)"
59-
Replace="@PACKAGE_NAME@" By="Bitcoin Core"></ReplaceInFile>
59+
Replace="@PACKAGE_NAME@" By="Bitcoin Inquisition"></ReplaceInFile>
6060
<ReplaceInFile FilePath="$(ConfigIniOut)"
6161
Replace="@PACKAGE_BUGREPORT@" By="https://github.com/bitcoin/bitcoin/issues"></ReplaceInFile>
6262
<ReplaceInFile FilePath="$(ConfigIniOut)"

build_msvc/msvc-autogen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def find_between( s, first, last ):
7070
config_dict = dict(item.split(", ") for item in config_info)
7171
config_dict["PACKAGE_VERSION"] = f"\"{config_dict['CLIENT_VERSION_MAJOR']}.{config_dict['CLIENT_VERSION_MINOR']}.{config_dict['CLIENT_VERSION_BUILD']}\""
7272
version = config_dict["PACKAGE_VERSION"].strip('"')
73-
config_dict["PACKAGE_STRING"] = f"\"Bitcoin Core {version}\""
73+
config_dict["PACKAGE_STRING"] = f"\"Bitcoin Inquisition {version}\""
7474

7575
with open(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h.in'), "r", encoding="utf8") as template_file:
7676
template = template_file.readlines()

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ define(_CLIENT_VERSION_IS_RELEASE, true)
77
define(_COPYRIGHT_YEAR, 2024)
88
define(_COPYRIGHT_HOLDERS,[The %s developers])
99
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Bitcoin Core]])
10-
AC_INIT([Bitcoin Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_BUILD)m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/bitcoin/bitcoin/issues],[bitcoin],[https://bitcoincore.org/])
10+
AC_INIT([Bitcoin Inquisition],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_BUILD)m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/bitcoin-inquisition/bitcoin/issues],[bitcoin],[https://bitcoincore.org/])
1111
AC_CONFIG_SRCDIR([src/validation.cpp])
1212
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
1313
AC_CONFIG_AUX_DIR([build-aux])

src/Makefile.test.include

+1-2
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ BITCOIN_TESTS =\
174174
test/validation_chainstatemanager_tests.cpp \
175175
test/validation_flush_tests.cpp \
176176
test/validation_tests.cpp \
177-
test/validationinterface_tests.cpp \
178-
test/versionbits_tests.cpp
177+
test/validationinterface_tests.cpp
179178

180179
if ENABLE_WALLET
181180
BITCOIN_TESTS += \

src/chainparams.cpp

+25-10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@
2323

2424
using util::SplitString;
2525

26+
static void HandleRenounceArgs(const ArgsManager& args, CChainParams::RenounceParameters& renounce)
27+
{
28+
if (!args.IsArgSet("-renounce")) return;
29+
for (const std::string& dep_name : args.GetArgs("-renounce")) {
30+
bool found = false;
31+
for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
32+
if (dep_name == VersionBitsDeploymentInfo[j].name) {
33+
renounce.emplace_back(static_cast<Consensus::BuriedDeployment>(j));
34+
found = true;
35+
LogPrintf("Disabling deployment %s\n", dep_name);
36+
break;
37+
}
38+
}
39+
if (!found) {
40+
throw std::runtime_error(strprintf("Invalid deployment (%s)", dep_name));
41+
}
42+
}
43+
}
44+
2645
void ReadSigNetArgs(const ArgsManager& args, CChainParams::SigNetOptions& options)
2746
{
2847
if (args.IsArgSet("-signetseednode")) {
@@ -39,6 +58,7 @@ void ReadSigNetArgs(const ArgsManager& args, CChainParams::SigNetOptions& option
3958
}
4059
options.challenge.emplace(*val);
4160
}
61+
HandleRenounceArgs(args, options.renounce);
4262
}
4363

4464
void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& options)
@@ -65,12 +85,14 @@ void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& opti
6585
}
6686
}
6787

88+
HandleRenounceArgs(args, options.renounce);
89+
6890
if (!args.IsArgSet("-vbparams")) return;
6991

7092
for (const std::string& strDeployment : args.GetArgs("-vbparams")) {
7193
std::vector<std::string> vDeploymentParams = SplitString(strDeployment, ':');
72-
if (vDeploymentParams.size() < 3 || 4 < vDeploymentParams.size()) {
73-
throw std::runtime_error("Version bits parameters malformed, expecting deployment:start:end[:min_activation_height]");
94+
if (vDeploymentParams.size() != 3) {
95+
throw std::runtime_error("Version bits parameters malformed, expecting deployment:start:end");
7496
}
7597
CChainParams::VersionBitsParameters vbparams{};
7698
if (!ParseInt64(vDeploymentParams[1], &vbparams.start_time)) {
@@ -79,19 +101,12 @@ void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& opti
79101
if (!ParseInt64(vDeploymentParams[2], &vbparams.timeout)) {
80102
throw std::runtime_error(strprintf("Invalid nTimeout (%s)", vDeploymentParams[2]));
81103
}
82-
if (vDeploymentParams.size() >= 4) {
83-
if (!ParseInt32(vDeploymentParams[3], &vbparams.min_activation_height)) {
84-
throw std::runtime_error(strprintf("Invalid min_activation_height (%s)", vDeploymentParams[3]));
85-
}
86-
} else {
87-
vbparams.min_activation_height = 0;
88-
}
89104
bool found = false;
90105
for (int j=0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
91106
if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {
92107
options.version_bits_parameters[Consensus::DeploymentPos(j)] = vbparams;
93108
found = true;
94-
LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d\n", vDeploymentParams[0], vbparams.start_time, vbparams.timeout, vbparams.min_activation_height);
109+
LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld\n", vDeploymentParams[0], vbparams.start_time, vbparams.timeout);
95110
break;
96111
}
97112
}

src/chainparamsbase.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
2020
argsman.AddArg("-testnet", "Use the testnet3 chain. Equivalent to -chain=test. Support for testnet3 is deprecated and will be removed in an upcoming release. Consider moving to testnet4 now by using -testnet4.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2121
argsman.AddArg("-testnet4", "Use the testnet4 chain. Equivalent to -chain=testnet4.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2222
argsman.AddArg("-vbparams=deployment:start:end[:min_activation_height]", "Use given start/end times and min_activation_height for specified version bits deployment (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
23+
argsman.AddArg("-renounce=deployment", "Unconditionally disable an heretical deployment attempt", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2324
argsman.AddArg("-signet", "Use the signet chain. Equivalent to -chain=signet. Note that the network is defined by the -signetchallenge parameter", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2425
argsman.AddArg("-signetchallenge", "Blocks must satisfy the given script to be considered valid (only for signet networks; defaults to the global default signet test network challenge)", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::CHAINPARAMS);
2526
argsman.AddArg("-signetseednode", "Specify a seed node for the signet network, in the hostname[:port] format, e.g. sig.net:1234 (may be used multiple times to specify multiple seed nodes; defaults to the global default signet test network seed node(s))", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::CHAINPARAMS);

src/clientversion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ std::string CopyrightHolders(const std::string& strPrefix)
8585

8686
std::string LicenseInfo()
8787
{
88-
const std::string URL_SOURCE_CODE = "<https://github.com/bitcoin/bitcoin>";
88+
const std::string URL_SOURCE_CODE = "<https://github.com/bitcoin/bitcoin-inquisition>";
8989

9090
return CopyrightHolders(strprintf(_("Copyright (C) %i-%i").translated, 2009, COPYRIGHT_YEAR) + " ") + "\n" +
9191
"\n" +

src/consensus/params.h

+14-12
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,30 @@ enum BuriedDeployment : int16_t {
2626
DEPLOYMENT_DERSIG,
2727
DEPLOYMENT_CSV,
2828
DEPLOYMENT_SEGWIT,
29+
DEPLOYMENT_TAPROOT,
2930
};
30-
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_SEGWIT; }
31+
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_TAPROOT; }
3132

3233
enum DeploymentPos : uint16_t {
3334
DEPLOYMENT_TESTDUMMY,
34-
DEPLOYMENT_TAPROOT, // Deployment of Schnorr/Taproot (BIPs 340-342)
3535
// NOTE: Also add new deployments to VersionBitsDeploymentInfo in deploymentinfo.cpp
3636
MAX_VERSION_BITS_DEPLOYMENTS
3737
};
3838
constexpr bool ValidDeployment(DeploymentPos dep) { return dep < MAX_VERSION_BITS_DEPLOYMENTS; }
3939

4040
/**
41-
* Struct for each individual consensus rule change using BIP9.
41+
* Struct for each individual consensus rule change
4242
*/
43-
struct BIP9Deployment {
44-
/** Bit position to select the particular bit in nVersion. */
45-
int bit{28};
43+
struct HereticalDeployment
44+
{
45+
/** nVersion values used to signal activation */
46+
int32_t signal_activate = -1;
47+
/** nVersion values used to signal abandonment */
48+
int32_t signal_abandon = -2;
4649
/** Start MedianTime for version bits miner confirmation. Can be a date in the past */
4750
int64_t nStartTime{NEVER_ACTIVE};
4851
/** Timeout/expiry MedianTime for the deployment attempt. */
4952
int64_t nTimeout{NEVER_ACTIVE};
50-
/** If lock in occurs, delay activation until at least this block
51-
* height. Note that activation will only occur on a retarget
52-
* boundary.
53-
*/
54-
int min_activation_height{0};
5553

5654
/** Constant for nTimeout very far in the future. */
5755
static constexpr int64_t NO_TIMEOUT = std::numeric_limits<int64_t>::max();
@@ -94,6 +92,8 @@ struct Params {
9492
* Note that segwit v0 script rules are enforced on all blocks except the
9593
* BIP 16 exception blocks. */
9694
int SegwitHeight;
95+
/** Block height at which Schnorr/Taproot (BIPs 340-342) becomes active. */
96+
int TaprootHeight;
9797
/** Don't warn about unknown BIP 9 activations below this height.
9898
* This prevents us from warning about the CSV and segwit activations. */
9999
int MinBIP9WarningHeight;
@@ -104,7 +104,7 @@ struct Params {
104104
*/
105105
uint32_t nRuleChangeActivationThreshold;
106106
uint32_t nMinerConfirmationWindow;
107-
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS];
107+
HereticalDeployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS];
108108
/** Proof of work parameters */
109109
uint256 powLimit;
110110
bool fPowAllowMinDifficultyBlocks;
@@ -146,6 +146,8 @@ struct Params {
146146
return CSVHeight;
147147
case DEPLOYMENT_SEGWIT:
148148
return SegwitHeight;
149+
case DEPLOYMENT_TAPROOT:
150+
return TaprootHeight;
149151
} // no default case, so the compiler can warn about missing cases
150152
return std::numeric_limits<int>::max();
151153
}

src/deploymentinfo.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_B
1515
/*.name =*/ "testdummy",
1616
/*.gbt_force =*/ true,
1717
},
18-
{
19-
/*.name =*/ "taproot",
20-
/*.gbt_force =*/ true,
21-
},
2218
};
2319

2420
std::string DeploymentName(Consensus::BuriedDeployment dep)
@@ -35,6 +31,8 @@ std::string DeploymentName(Consensus::BuriedDeployment dep)
3531
return "csv";
3632
case Consensus::DEPLOYMENT_SEGWIT:
3733
return "segwit";
34+
case Consensus::DEPLOYMENT_TAPROOT:
35+
return "taproot";
3836
} // no default case, so the compiler can warn about missing cases
3937
return "";
4038
}

src/deploymentstatus.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus
2020
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos dep, VersionBitsCache& versionbitscache)
2121
{
2222
assert(Consensus::ValidDeployment(dep));
23-
return ThresholdState::ACTIVE == versionbitscache.State(pindexPrev, params, dep);
23+
const auto state = versionbitscache.State(pindexPrev, params, dep);
24+
return state == ThresholdState::ACTIVE || state == ThresholdState::DEACTIVATING;
2425
}
2526

2627
/** Determine if a deployment is active for this block */
@@ -46,7 +47,7 @@ inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::Buried
4647
inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::DeploymentPos dep)
4748
{
4849
assert(Consensus::ValidDeployment(dep));
49-
return params.vDeployments[dep].nStartTime != Consensus::BIP9Deployment::NEVER_ACTIVE;
50+
return params.vDeployments[dep].nStartTime != Consensus::HereticalDeployment::NEVER_ACTIVE;
5051
}
5152

5253
#endif // BITCOIN_DEPLOYMENTSTATUS_H

src/init.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ void SetupServerArgs(ArgsManager& argsman)
632632
Ticks<std::chrono::seconds>(DEFAULT_MAX_TIP_AGE)),
633633
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
634634
argsman.AddArg("-printpriority", strprintf("Log transaction fee rate in " + CURRENCY_UNIT + "/kvB when mining blocks (default: %u)", DEFAULT_PRINT_MODIFIED_FEE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
635-
argsman.AddArg("-uacomment=<cmt>", "Append comment to the user agent string", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
635+
argsman.AddArg("-uacomment=<cmt>", "Append comment to the user agent string (default: inquisition)", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
636636

637637
SetupChainParamsBaseOptions(argsman);
638638

@@ -1140,6 +1140,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
11401140
const ArgsManager& args = *Assert(node.args);
11411141
const CChainParams& chainparams = Params();
11421142

1143+
// Disallow mainnet/testnet operation
1144+
if (Params().GetChainType() == ChainType::MAIN || Params().GetChainType() == ChainType::TESTNET) {
1145+
return InitError(Untranslated(strprintf("Selected network '%s' is unsupported for this client, select -regtest or -signet instead.\n", Params().GetChainTypeString())));
1146+
}
1147+
11431148
auto opt_max_upload = ParseByteUnits(args.GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET), ByteUnit::M);
11441149
if (!opt_max_upload) {
11451150
return InitError(strprintf(_("Unable to parse -maxuploadtarget: '%s'"), args.GetArg("-maxuploadtarget", "")));
@@ -1356,6 +1361,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
13561361

13571362
// sanitize comments per BIP-0014, format user agent and check total size
13581363
std::vector<std::string> uacomments;
1364+
if (!args.IsArgSet("-uacomment") && !args.IsArgNegated("-uacomment")) {
1365+
uacomments.push_back("inquisition");
1366+
}
13591367
for (const std::string& cmt : args.GetArgs("-uacomment")) {
13601368
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
13611369
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));

0 commit comments

Comments
 (0)