MCPcopy Create free account
hub / github.com/ElementsProject/elements / ComputeNextBlockCurrentParameters

Function ComputeNextBlockCurrentParameters

src/dynafed.cpp:102–124  ·  view source on GitHub ↗

TODO cache this in CBlockIndex itself?

Source from the content-addressed store, hash-verified

100
101// TODO cache this in CBlockIndex itself?
102DynaFedParamEntry ComputeNextBlockCurrentParameters(const CBlockIndex* pindexPrev, const Consensus::Params& consensus)
103{
104 assert(pindexPrev);
105
106 if (node::fTrimHeaders) {
107 LOCK(cs_main);
108 ForceUntrimHeader(pindexPrev);
109 }
110 DynaFedParamEntry entry = ComputeNextBlockFullCurrentParameters(pindexPrev, consensus);
111
112 uint32_t next_height = pindexPrev->nHeight+1;
113 const uint32_t epoch_length = consensus.dynamic_epoch_length;
114 uint32_t epoch_age = next_height % epoch_length;
115
116 // Return appropriate format based on epoch age or if we *just* activated
117 // dynafed via BIP9
118 if (epoch_age == 0 || pindexPrev->dynafed_params().IsNull()) {
119 return entry;
120 } else {
121 return DynaFedParamEntry(entry.m_signblockscript, entry.m_signblock_witness_limit, entry.CalculateExtraRoot());
122
123 }
124}
125

Callers 2

CreateNewBlockMethod · 0.85

Calls 4

CalculateExtraRootMethod · 0.80
DynaFedParamEntryClass · 0.50
IsNullMethod · 0.45

Tested by

no test coverage detected