Skip to content

Commit

Permalink
Use most recent rates before height
Browse files Browse the repository at this point in the history
  • Loading branch information
StarNeit committed Nov 30, 2020
1 parent 580a2a9 commit f22a733
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion node/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,16 @@ func (d *Pegnetd) SyncBlock(ctx context.Context, tx *sql.Tx, height uint32) erro

// check if the height has no rates, what do we do?
// check rates from previous height
if rates == nil {
if rates == nil && height < V202EnhanceActivation {
// We need to handle the no rates case. Miners could avoid mining this last block.
// use the last valid rates from last block
rates, err = d.Pegnet.SelectPendingRates(ctx, tx, height-1)
}

if rates == nil && height >= V202EnhanceActivation {
rates, _, err = d.Pegnet.SelectMostRecentRatesBeforeHeight(ctx, tx, height)
}

// If no rates for second time, skip Snapshot logic
// otherwise proceed with payout
if rates != nil {
Expand Down

0 comments on commit f22a733

Please sign in to comment.