Merge #720: Fix liquidv1 sync

85de70cdf Don't activate dynafed like custom chains (Gregory Sanders)
b73ff4ccf Fix liquidv1 sync (Gregory Sanders)

Pull request description:

  A single field wasn't given a positive value which
  meant it considers no peg-ins to be valid. This is something introduced by dynafed.

  I put in a guess placeholder, the important part is that it's > 0.

Tree-SHA512: 5a70b282fcf3a47fb17181eafd74f6f5cc2209f18111d6ae21ca0cac50bf63e4864f694826902e1a9ca032f5686c537653fe080d42a5e6ca946354a74998ebf5
This commit is contained in:
Steven Roose 2019-09-27 10:38:53 +02:00
commit 690fed668c
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
3 changed files with 12 additions and 2 deletions

View file

@ -725,6 +725,9 @@ public:
g_con_blockheightinheader = true;
g_con_elementsmode = true;
// TODO: Pick appropriate value for this network.
consensus.total_valid_epochs = 2;
consensus.genesis_subsidy = 0;
@ -786,6 +789,12 @@ public:
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();

View file

@ -106,7 +106,8 @@ struct Params {
// Used to seed the extension space for first dynamic blocks
std::vector<std::vector<unsigned char>> 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

View file

@ -492,7 +492,7 @@ std::vector<std::pair<CScript, CScript>> 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;
}