s/ConsensusParamEntry/DynaFedParamEntry/

This commit is contained in:
Gregory Sanders 2019-06-14 13:14:06 -04:00
parent 642260a126
commit 15996384d4
10 changed files with 33 additions and 33 deletions

View file

@ -2,7 +2,7 @@
#include <dynafed.h>
#include <script/standard.h>
bool NextBlockIsParameterTransition(const CBlockIndex* pindexPrev, const Consensus::Params& consensus, ConsensusParamEntry& winning_entry)
bool NextBlockIsParameterTransition(const CBlockIndex* pindexPrev, const Consensus::Params& consensus, DynaFedParamEntry& winning_entry)
{
uint32_t next_height = pindexPrev->nHeight + 1;
assert(consensus.dynamic_epoch_length != 0);
@ -15,7 +15,7 @@ bool NextBlockIsParameterTransition(const CBlockIndex* pindexPrev, const Consens
for (int32_t height = next_height - 1; height >= (int32_t)(next_height - consensus.dynamic_epoch_length); --height) {
const CBlockIndex* p_epoch_walk = pindexPrev->GetAncestor(height);
assert(p_epoch_walk);
const ConsensusParamEntry& proposal = p_epoch_walk->dynafed_params.m_proposed;
const DynaFedParamEntry& proposal = p_epoch_walk->dynafed_params.m_proposed;
const uint256 proposal_root = proposal.CalculateRoot();
vote_tally[proposal_root]++;
// Short-circuit once 4/5 threshhold is reached
@ -35,7 +35,7 @@ bool NextBlockIsParameterTransition(const CBlockIndex* pindexPrev, const Consens
return false;
}
ConsensusParamEntry ComputeNextBlockFullCurrentParameters(const CBlockIndex* pindexPrev, const Consensus::Params& consensus)
DynaFedParamEntry ComputeNextBlockFullCurrentParameters(const CBlockIndex* pindexPrev, const Consensus::Params& consensus)
{
assert(pindexPrev);
@ -43,7 +43,7 @@ ConsensusParamEntry ComputeNextBlockFullCurrentParameters(const CBlockIndex* pin
const uint32_t epoch_length = consensus.dynamic_epoch_length;
uint32_t epoch_age = next_height % epoch_length;
ConsensusParamEntry winning_proposal;
DynaFedParamEntry winning_proposal;
// Early return when there is a winning proposal
if (NextBlockIsParameterTransition(pindexPrev, consensus, winning_proposal)) {
assert(epoch_age == 0);
@ -68,7 +68,7 @@ ConsensusParamEntry ComputeNextBlockFullCurrentParameters(const CBlockIndex* pin
// Convert signblockscript to P2WSH
CScript p2wsh_signblock_script = GetScriptForDestination(WitnessV0ScriptHash(p_epoch_start->proof.challenge));
winning_proposal = ConsensusParamEntry(p2wsh_signblock_script, consensus.max_block_signature_size+consensus.signblockscript.size(), consensus.fedpegScript, consensus.first_extension_space);
winning_proposal = DynaFedParamEntry(p2wsh_signblock_script, consensus.max_block_signature_size+consensus.signblockscript.size(), consensus.fedpegScript, consensus.first_extension_space);
} else {
winning_proposal = p_epoch_start->dynafed_params.m_current;
}
@ -76,11 +76,11 @@ ConsensusParamEntry ComputeNextBlockFullCurrentParameters(const CBlockIndex* pin
}
// TODO cache this in CBlockIndex itself?
ConsensusParamEntry ComputeNextBlockCurrentParameters(const CBlockIndex* pindexPrev, const Consensus::Params& consensus)
DynaFedParamEntry ComputeNextBlockCurrentParameters(const CBlockIndex* pindexPrev, const Consensus::Params& consensus)
{
assert(pindexPrev);
ConsensusParamEntry entry = ComputeNextBlockFullCurrentParameters(pindexPrev, consensus);
DynaFedParamEntry entry = ComputeNextBlockFullCurrentParameters(pindexPrev, consensus);
uint32_t next_height = pindexPrev->nHeight+1;
const uint32_t epoch_length = consensus.dynamic_epoch_length;
@ -89,7 +89,7 @@ ConsensusParamEntry ComputeNextBlockCurrentParameters(const CBlockIndex* pindexP
// Return appropriate format based on epoch age
if (epoch_age > 0) {
// TODO implement "prune" function to remove fields in place and change serialize type
return ConsensusParamEntry(entry.m_signblockscript, entry.m_signblock_witness_limit);
return DynaFedParamEntry(entry.m_signblockscript, entry.m_signblock_witness_limit);
} else {
return entry;
}