From 7eea59a2cabf0f64533ecd9f37307f79331bd303 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Fri, 12 Apr 2019 10:21:53 -0400 Subject: [PATCH] configure option --enable-liquid for default liquidv1 chain --- configure.ac | 12 ++++++++++++ src/test/util_tests.cpp | 6 +++++- src/util.cpp | 7 ++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f020551eb6..2baa241238 100644 --- a/configure.ac +++ b/configure.ac @@ -194,10 +194,20 @@ AC_ARG_ENABLE([asm], [use_asm=$enableval], [use_asm=yes]) +AC_ARG_ENABLE([liquid], + [AS_HELP_STRING([--enable-liquid], + [Enable build that defaults to -chain=liquidv1])], + [liquid_build=yes], + [liquid_build=no]) + if test "x$use_asm" = xyes; then AC_DEFINE(USE_ASM, 1, [Define this symbol to build in assembly routines]) fi +if test "x$liquid_build" = xyes; then + AC_DEFINE(LIQUID, 1, [Define this symbol for Liquid builds]) +fi + AC_ARG_WITH([system-univalue], [AS_HELP_STRING([--with-system-univalue], [Build with system UniValue (default is no)])], @@ -1378,6 +1388,7 @@ AM_CONDITIONAL([ENABLE_SSE41],[test x$enable_sse41 = xyes]) AM_CONDITIONAL([ENABLE_AVX2],[test x$enable_avx2 = xyes]) AM_CONDITIONAL([ENABLE_SHANI],[test x$enable_shani = xyes]) AM_CONDITIONAL([USE_ASM],[test x$use_asm = xyes]) +AM_CONDITIONAL([LIQUID],[test x$liquid_build = xyes]) AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) @@ -1510,6 +1521,7 @@ echo " with test = $use_tests" echo " with bench = $use_bench" echo " with upnp = $use_upnp" echo " use asm = $use_asm" +echo " liquid_build = $liquid_build" echo " sanitizers = $use_sanitizers" echo " debug enabled = $enable_debug" echo " gprof enabled = $enable_gprof" diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index b5c39f9662..8bf34251dc 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -558,7 +558,11 @@ BOOST_AUTO_TEST_CASE(util_GetChainName) std::string error; test_args.ParseParameters(0, (char**)argv_testnet, error); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "elementsregtest"); + std::string default_chain = "elementsregtest"; +#if LIQUID + default_chain = "liquidv1"; +#endif + BOOST_CHECK_EQUAL(test_args.GetChainName(), default_chain); test_args.ParseParameters(2, (char**)argv_testnet, error); BOOST_CHECK_EQUAL(test_args.GetChainName(), "test"); diff --git a/src/util.cpp b/src/util.cpp index ff30941314..25b71a7542 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -980,7 +980,12 @@ std::string ArgsManager::GetChainName() const return CBaseChainParams::REGTEST; if (fTestNet) return CBaseChainParams::TESTNET; - return GetArg("-chain", "elementsregtest"); + + std::string default_chain = "elementsregtest"; +#ifdef LIQUID + default_chain = "liquidv1"; +#endif + return GetArg("-chain", default_chain); } #ifndef WIN32