From 47d6c3438265a074c4b6d666c9144f0ee827ef81 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Wed, 24 Jul 2024 09:34:16 +0200 Subject: [PATCH 1/2] discount: fix override for creatediscountct --- src/chainparams.cpp | 6 +++--- test/functional/feature_discount_ct.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index e3f0114e76..570f3eff64 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -896,7 +896,7 @@ class CCustomParams : public CRegTestParams { consensus.fedpegScript = StrHexToScriptWithDefault(args.GetArg("-fedpegscript", ""), default_script); consensus.start_p2wsh_script = args.GetIntArg("-con_start_p2wsh_script", consensus.start_p2wsh_script); create_discount_ct = args.GetBoolArg("-creatediscountct", false); - accept_discount_ct = args.GetBoolArg("-acceptdiscountct", create_discount_ct); + accept_discount_ct = args.GetBoolArg("-acceptdiscountct", false) || create_discount_ct; // Calculate pegged Bitcoin asset std::vector commit = CommitToArguments(consensus, strNetworkID); @@ -1129,7 +1129,7 @@ class CLiquidV1Params : public CChainParams { multi_data_permitted = true; create_discount_ct = args.GetBoolArg("-creatediscountct", false); - accept_discount_ct = args.GetBoolArg("-acceptdiscountct", false); + accept_discount_ct = args.GetBoolArg("-acceptdiscountct", false) || create_discount_ct; parentGenesisBlockHash = uint256S("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); const bool parent_genesis_is_null = parentGenesisBlockHash == uint256(); @@ -1479,7 +1479,7 @@ class CLiquidV1TestParams : public CLiquidV1Params { multi_data_permitted = args.GetBoolArg("-multi_data_permitted", multi_data_permitted); create_discount_ct = args.GetBoolArg("-creatediscountct", create_discount_ct); - accept_discount_ct = args.GetBoolArg("-acceptdiscountct", accept_discount_ct || create_discount_ct); + accept_discount_ct = args.GetBoolArg("-acceptdiscountct", accept_discount_ct) || create_discount_ct; if (args.IsArgSet("-parentgenesisblockhash")) { parentGenesisBlockHash = uint256S(args.GetArg("-parentgenesisblockhash", "")); diff --git a/test/functional/feature_discount_ct.py b/test/functional/feature_discount_ct.py index b4c2fb9a4d..fe588640f8 100755 --- a/test/functional/feature_discount_ct.py +++ b/test/functional/feature_discount_ct.py @@ -26,7 +26,8 @@ def set_test_params(self): # node 1 accepts but does not create discounted CTs args + ["-acceptdiscountct=1", "-creatediscountct=0"], # node 2 both accepts and creates discounted CTs - args + ["-acceptdiscountct=1", "-creatediscountct=1"], + # check that 'create' overrides 'accept' + args + ["-acceptdiscountct=0", "-creatediscountct=1"], ] def skip_test_if_missing_module(self): From fdf3d1eab13346924f12f2a93ea5e5b00f36304d Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Wed, 24 Jul 2024 09:35:03 +0200 Subject: [PATCH 2/2] discount: update init doc for acceptdiscountct --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index f3098e7f4b..990ffcc6e2 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -640,7 +640,7 @@ void SetupServerArgs(ArgsManager& argsman) argsman.AddArg("-initialreissuancetokens=", "The amount of reissuance tokens created in the genesis block. (default: 0)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-ct_bits", strprintf("The default number of hiding bits in a rangeproof. Will be exceeded to cover amounts exceeding the maximum hiding value. (default: %d)", 52), ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-ct_exponent", strprintf("The hiding exponent. (default: %s)", 0), ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); - argsman.AddArg("-acceptdiscountct", "Accept discounted fees for Confidential Transactions (default: true for liquidv1, false for other chains)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); + argsman.AddArg("-acceptdiscountct", "Accept discounted fees for Confidential Transactions (default: false)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-creatediscountct", "Create Confidential Transactions with discounted fees (default: false). Setting this to true will also set 'acceptdiscountct' to true.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); #if defined(USE_SYSCALL_SANDBOX)