Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
psgreco committed Oct 2, 2023
1 parent af1b642 commit c06a2e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dynafed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ bool NextBlockIsParameterTransition(const CBlockIndex* pindexPrev, const Consens
winning_entry.SetNull();
return false;
}
LOCK(cs_main);
std::map<uint256, uint32_t> vote_tally;
assert(next_height >= consensus.dynamic_epoch_length);
for (int32_t height = next_height - 1; height >= (int32_t)(next_height - consensus.dynamic_epoch_length); --height) {
Expand Down Expand Up @@ -62,6 +63,7 @@ DynaFedParamEntry ComputeNextBlockFullCurrentParameters(const CBlockIndex* pinde
// may be pre-dynafed params
const CBlockIndex* p_epoch_start = pindexPrev->GetAncestor(epoch_start_height);
assert(p_epoch_start);
LOCK(cs_main);
ForceUntrimHeader(p_epoch_start);
if (p_epoch_start->dynafed_params().IsNull()) {
// We need to construct the "full" current parameters of pre-dynafed
Expand Down Expand Up @@ -96,6 +98,7 @@ DynaFedParamEntry ComputeNextBlockCurrentParameters(const CBlockIndex* pindexPre
{
assert(pindexPrev);

LOCK(cs_main);
ForceUntrimHeader(pindexPrev);
DynaFedParamEntry entry = ComputeNextBlockFullCurrentParameters(pindexPrev, consensus);

Expand Down
1 change: 1 addition & 0 deletions src/pegins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ std::vector<std::pair<CScript, CScript>> GetValidFedpegScripts(const CBlockIndex
fedpegscripts.push_back(std::make_pair(next_param.m_fedpeg_program, next_param.m_fedpegscript));
}

LOCK(cs_main);
// Next we walk backwards up to M epoch starts
for (int32_t i = 0; i < (int32_t) params.total_valid_epochs; i++) {
// We are within total_valid_epochs of the genesis
Expand Down
2 changes: 2 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2467,6 +2467,7 @@ void ForceUntrimHeader(const CBlockIndex *pindex_)
if (!pindex_->trimmed()) {
return;
}
LOCK(cs_main);
AssertLockHeld(cs_main);
CBlockIndex* pindex = const_cast<CBlockIndex*>(pindex_);
pindex->untrim();
Expand Down Expand Up @@ -2510,6 +2511,7 @@ void CChainState::UpdateTip(const CBlockIndex* pindexNew)
this->CoinsTip().DynamicMemoryUsage() * (1.0 / (1<<20)), this->CoinsTip().GetCacheSize(),
!warning_messages.empty() ? strprintf(" warning='%s'", warning_messages.original) : "");

LOCK(cs_main);
ForceUntrimHeader(pindexNew);
// Do some logging if dynafed parameters changed.
if (pindexNew->pprev && !pindexNew->dynafed_params().IsNull()) {
Expand Down

0 comments on commit c06a2e2

Please sign in to comment.