From b73ff4ccfe70f1cc5451f3f7570cd6e2e8246621 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 25 Sep 2019 21:01:55 -0400 Subject: [PATCH 1/2] Fix liquidv1 sync A single field wasn't given a positive value which meant it considers no peg-ins to be valid. --- src/chainparams.cpp | 3 +++ src/consensus/params.h | 3 ++- src/pegins.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 37412b381c1..4f96ae8034b 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -725,6 +725,9 @@ class CLiquidV1Params : public CChainParams { g_con_blockheightinheader = true; g_con_elementsmode = true; + // TODO: Pick appropriate value for this network. + consensus.total_valid_epochs = 2; + consensus.genesis_subsidy = 0; diff --git a/src/consensus/params.h b/src/consensus/params.h index b5be5eae129..aaf4cf14013 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -106,7 +106,8 @@ struct Params { // Used to seed the extension space for first dynamic blocks std::vector> first_extension_space; // Used to allow M-epoch-old peg-in addresses as deposits - size_t total_valid_epochs; + // default 1 to not break legacy chains implicitly. + size_t total_valid_epochs = 1; }; } // namespace Consensus diff --git a/src/pegins.cpp b/src/pegins.cpp index c013a970dc7..167d1cd3dd1 100644 --- a/src/pegins.cpp +++ b/src/pegins.cpp @@ -492,7 +492,7 @@ std::vector> GetValidFedpegScripts(const CBlockIndex fedpegscripts.push_back(std::make_pair(GetScriptForDestination(ScriptHash(GetScriptForDestination(WitnessV0ScriptHash(params.fedpegScript)))), params.fedpegScript)); } } - // Only return up to the latest two of three possible fedpegscripts, which are enforced + // Only return up to the latest total_valid_epochs fedpegscripts, which are enforced fedpegscripts.resize(std::min(fedpegscripts.size(), params.total_valid_epochs)); return fedpegscripts; } From 85de70cdfaa64d114f349542e17d320d0540a64c Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Thu, 26 Sep 2019 09:06:20 -0400 Subject: [PATCH 2/2] Don't activate dynafed like custom chains --- src/chainparams.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 4f96ae8034b..0c5e6d3f7cd 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -789,6 +789,12 @@ class CLiquidV1Params : public CChainParams { consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; + // Not active yet. + consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].bit = 0; + consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = 0; + consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = 0; + + // Finally, create genesis block genesis = CreateGenesisBlock(consensus, CScript(commit), CScript(OP_RETURN), 1296688602, 2, 0x207fffff, 1, 0); consensus.hashGenesisBlock = genesis.GetHash();