From 983cb25a0794509365fcf89f2835589126237876 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Fri, 7 Aug 2020 10:57:02 +0200 Subject: [PATCH] les: update checktime even if check fails --- les/checkpointoracle/oracle.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/les/checkpointoracle/oracle.go b/les/checkpointoracle/oracle.go index 8f2dda393..003eb17df 100644 --- a/les/checkpointoracle/oracle.go +++ b/les/checkpointoracle/oracle.go @@ -93,8 +93,11 @@ func (oracle *CheckpointOracle) StableCheckpoint() (*params.TrustedCheckpoint, u // Look it up properly // Retrieve the latest checkpoint from the contract, abort if empty latest, hash, height, err := oracle.contract.Contract().GetLatestCheckpoint(nil) + oracle.lastCheckTime = time.Now() if err != nil || (latest == 0 && hash == [32]byte{}) { - return nil, 0 + oracle.lastCheckPointHeight = 0 + oracle.lastCheckPoint = nil + return oracle.lastCheckPoint, oracle.lastCheckPointHeight } local := oracle.getLocal(latest) @@ -106,10 +109,9 @@ func (oracle *CheckpointOracle) StableCheckpoint() (*params.TrustedCheckpoint, u // // In both cases, no stable checkpoint will be returned. if local.HashEqual(hash) { - oracle.lastCheckTime = time.Now() oracle.lastCheckPointHeight = height.Uint64() oracle.lastCheckPoint = &local - return &local, height.Uint64() + return oracle.lastCheckPoint, oracle.lastCheckPointHeight } return nil, 0 }