From f22a7339c4f92cd0c96c334ae45b3f0fb73401d3 Mon Sep 17 00:00:00 2001 From: StarNeit Date: Mon, 30 Nov 2020 20:42:31 +0100 Subject: [PATCH] Use most recent rates before height --- node/sync.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/sync.go b/node/sync.go index 2996115..b58846c 100644 --- a/node/sync.go +++ b/node/sync.go @@ -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 {