From 500a3731a6790369fbee2decab76f58979bacaad Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 25 Sep 2019 09:10:13 -0400 Subject: [PATCH] Add legacy pak arg for custom chains --- src/chainparams.cpp | 10 ++++++++-- src/chainparamsbase.cpp | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 72e84eaa00..e4921285ef 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -487,9 +487,15 @@ class CCustomParams : public CRegTestParams { consensus.defaultAssumeValid = uint256S(args.GetArg("-con_defaultassumevalid", "0x00")); // TODO: Embed in genesis block in nTime field with new genesis block type consensus.dynamic_epoch_length = args.GetArg("-dynamic_epoch_length", 10); - // TODO: pass in serialized vector of byte vectors, parse into extension space - // Junk keys for testing + // Default junk keys for testing consensus.first_extension_space = {ParseHex("02fcba7ecf41bc7e1be4ee122d9d22e3333671eb0a3a87b5cdf099d59874e1940f02fcba7ecf41bc7e1be4ee122d9d22e3333671eb0a3a87b5cdf099d59874e1940f")}; + std::vector pak_list_str = args.GetArgs("-pak"); + if (!pak_list_str.empty()) { + consensus.first_extension_space.clear(); + for (const auto& entry : pak_list_str) { + consensus.first_extension_space.push_back(ParseHex(entry)); + } + } nPruneAfterHeight = (uint64_t)args.GetArg("-npruneafterheight", nPruneAfterHeight); fDefaultConsistencyChecks = args.GetBoolArg("-fdefaultconsistencychecks", fDefaultConsistencyChecks); diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index ac4efc9b33..fe8b73861e 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -44,6 +44,7 @@ void SetupChainParamsBaseOptions() gArgs.AddArg("-fedpegscript", "The script for the federated peg enforce from genesis block. This script may stop being enforced once dynamic federations activates.", false, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-enforce_pak", "Causes standardness checks to enforce Pegout Authorization Key(PAK) validation before dynamic federations, and consensus enforcement after.", false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-pak", "Sets the 'first extension space' field to the pak entries ala pre-dynamic federations. Only used for testing in custom chains.", false, OptionsCategory::ELEMENTS); gArgs.AddArg("-multi_data_permitted", "Allow relay of multiple OP_RETURN outputs. (default: -enforce_pak)", false, OptionsCategory::ELEMENTS); gArgs.AddArg("-con_csv_deploy_start", "Starting height for CSV deployment. (default: -1, which means ACTIVE from genesis)", false, OptionsCategory::ELEMENTS); gArgs.AddArg("-con_dyna_deploy_start", "Starting height for Dynamic Federations deployment. Once active, signblockscript becomes a BIP141 WSH scriptPubKey of the original signblockscript. All other dynamic parameters stay constant.(default: -1, which means ACTIVE from genesis)", false, OptionsCategory::ELEMENTS);