Add regtest support to bitcoin-chainstate tool
Adds -regtest flag to enable testing with regtest chain parameters.
This commit is contained in:
1 file changed
+6
-4
@@ -144,16 +144,18 @@ public:
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// SETUP: Argument parsing and handling
|
// SETUP: Argument parsing and handling
|
||||||
if (argc != 2) {
|
const bool has_regtest_flag{argc == 3 && std::string(argv[1]) == "-regtest"};
|
||||||
|
if (argc < 2 || argc > 3 || (argc == 3 && !has_regtest_flag)) {
|
||||||
std::cerr
|
std::cerr
|
||||||
<< "Usage: " << argv[0] << " DATADIR" << std::endl
|
<< "Usage: " << argv[0] << " [-regtest] DATADIR" << std::endl
|
||||||
<< "Display DATADIR information, and process hex-encoded blocks on standard input." << std::endl
|
<< "Display DATADIR information, and process hex-encoded blocks on standard input." << std::endl
|
||||||
|
<< "Uses mainnet parameters by default, regtest with -regtest flag" << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< "IMPORTANT: THIS EXECUTABLE IS EXPERIMENTAL, FOR TESTING ONLY, AND EXPECTED TO" << std::endl
|
<< "IMPORTANT: THIS EXECUTABLE IS EXPERIMENTAL, FOR TESTING ONLY, AND EXPECTED TO" << std::endl
|
||||||
<< " BREAK IN FUTURE VERSIONS. DO NOT USE ON YOUR ACTUAL DATADIR." << std::endl;
|
<< " BREAK IN FUTURE VERSIONS. DO NOT USE ON YOUR ACTUAL DATADIR." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
std::filesystem::path abs_datadir{std::filesystem::absolute(argv[1])};
|
std::filesystem::path abs_datadir{std::filesystem::absolute(argv[argc-1])};
|
||||||
std::filesystem::create_directories(abs_datadir);
|
std::filesystem::create_directories(abs_datadir);
|
||||||
|
|
||||||
btck_LoggingOptions logging_options = {
|
btck_LoggingOptions logging_options = {
|
||||||
@@ -169,7 +171,7 @@ int main(int argc, char* argv[])
|
|||||||
Logger logger{std::make_unique<KernelLog>()};
|
Logger logger{std::make_unique<KernelLog>()};
|
||||||
|
|
||||||
ContextOptions options{};
|
ContextOptions options{};
|
||||||
ChainParams params{ChainType::MAINNET};
|
ChainParams params{has_regtest_flag ? ChainType::REGTEST : ChainType::MAINNET};
|
||||||
options.SetChainParams(params);
|
options.SetChainParams(params);
|
||||||
|
|
||||||
options.SetNotifications(std::make_shared<TestKernelNotifications>());
|
options.SetNotifications(std::make_shared<TestKernelNotifications>());
|
||||||
|
|||||||
Reference in new issue
Block a user