Skip to content

Commit 406580e

Browse files
committed
Merge #520: [0.17] Default to elementsregtest, when syncing liquid, find cookie
5273ed5 Default to mainnet cookie for liquidv1 (Gregory Sanders) 8ea52ee Default to elementsregtest (Gregory Sanders) Pull request description: Cookie defaults looking in `regtest` directory currently. Tree-SHA512: df8e384f12c84e7adf86edcc2d4a96432187ce58b76f19ea347b911988f55177efebcd8f5a5986acfe19044535b27ad896ec3f75a273bae24826e33ba58f40e0
2 parents 7e3f687 + 5273ed5 commit 406580e

4 files changed

Lines changed: 80 additions & 75 deletions

File tree

src/rpc/protocol.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,12 @@ static const std::string MAINCHAIN_COOKIEAUTH_FILE = "regtest/.cookie";
131131
/** Get name mainchain RPC authentication cookie file */
132132
static fs::path GetMainchainAuthCookieFile()
133133
{
134-
boost::filesystem::path path(gArgs.GetArg("-mainchainrpccookiefile", MAINCHAIN_COOKIEAUTH_FILE));
134+
std::string cookie_file = MAINCHAIN_COOKIEAUTH_FILE;
135+
// Bitcoin mainnet exception
136+
if (gArgs.GetChainName() == "liquidv1") {
137+
cookie_file = ".cookie";
138+
}
139+
boost::filesystem::path path(gArgs.GetArg("-mainchainrpccookiefile", cookie_file));
135140
if (!path.is_complete()) path = GetDataDir(false) / path;
136141
return path;
137142
}

src/test/util_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
558558
std::string error;
559559

560560
test_args.ParseParameters(0, (char**)argv_testnet, error);
561-
BOOST_CHECK_EQUAL(test_args.GetChainName(), "main");
561+
BOOST_CHECK_EQUAL(test_args.GetChainName(), "elementsregtest");
562562

563563
test_args.ParseParameters(2, (char**)argv_testnet, error);
564564
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");

src/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ std::string ArgsManager::GetChainName() const
980980
return CBaseChainParams::REGTEST;
981981
if (fTestNet)
982982
return CBaseChainParams::TESTNET;
983-
return GetArg("-chain", CBaseChainParams::MAIN);
983+
return GetArg("-chain", "elementsregtest");
984984
}
985985

986986
#ifndef WIN32

0 commit comments

Comments
 (0)