Skip to content

Commit

Permalink
Fix another subtle error in renewal chain walker
Browse files Browse the repository at this point in the history
In GetNewbieSuperblockAccrualCorrection the while loop that walks
the beacon chain backwards to the original advertisement has a
mistake and uses beacon instead of beacon_ptr in the find. As a
result it will not work for more than one renewal cycle.

This is not a consensus issue, because this function is not called
for beacons that have more than one renewal cycle. In fact, now
that the newbie bug is out of the way, it will not be called for
beacons with any renewal at all. So this is merely for correctness.
  • Loading branch information
jamescowens committed Mar 16, 2021
1 parent 7f75aec commit df3b201
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gridcoin/tally.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ CAmount Tally::GetNewbieSuperblockAccrualCorrection(const Cpid& cpid, const Supe
// than here.
while (beacon_ptr->Renewed())
{
beacon_ptr = std::make_shared<Beacon>(beacons.GetBeaconDB().find(beacon->m_prev_beacon_hash)->second);
beacon_ptr = std::make_shared<Beacon>(beacons.GetBeaconDB().find(beacon_ptr->m_prev_beacon_hash)->second);
}

const CBlockIndex* pindex_baseline = GRC::Tally::GetBaseline();
Expand Down

0 comments on commit df3b201

Please sign in to comment.