Skip to content

Commit

Permalink
Merge ElementsProject#520: [0.17] Default to elementsregtest, when sy…
Browse files Browse the repository at this point in the history
…ncing 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
  • Loading branch information
instagibbs committed Mar 21, 2019
2 parents 7e3f687 + 5273ed5 commit 406580e
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 75 deletions.
7 changes: 6 additions & 1 deletion src/rpc/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ static const std::string MAINCHAIN_COOKIEAUTH_FILE = "regtest/.cookie";
/** Get name mainchain RPC authentication cookie file */
static fs::path GetMainchainAuthCookieFile()
{
boost::filesystem::path path(gArgs.GetArg("-mainchainrpccookiefile", MAINCHAIN_COOKIEAUTH_FILE));
std::string cookie_file = MAINCHAIN_COOKIEAUTH_FILE;
// Bitcoin mainnet exception
if (gArgs.GetChainName() == "liquidv1") {
cookie_file = ".cookie";
}
boost::filesystem::path path(gArgs.GetArg("-mainchainrpccookiefile", cookie_file));
if (!path.is_complete()) path = GetDataDir(false) / path;
return path;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/util_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
std::string error;

test_args.ParseParameters(0, (char**)argv_testnet, error);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "main");
BOOST_CHECK_EQUAL(test_args.GetChainName(), "elementsregtest");

test_args.ParseParameters(2, (char**)argv_testnet, error);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
Expand Down
2 changes: 1 addition & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ std::string ArgsManager::GetChainName() const
return CBaseChainParams::REGTEST;
if (fTestNet)
return CBaseChainParams::TESTNET;
return GetArg("-chain", CBaseChainParams::MAIN);
return GetArg("-chain", "elementsregtest");
}

#ifndef WIN32
Expand Down
Loading

0 comments on commit 406580e

Please sign in to comment.