Skip to content

Commit

Permalink
les: update checktime even if check fails
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored and enriquefynn committed Feb 15, 2021
1 parent e7a9177 commit d73915e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions les/checkpointoracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
}
Expand Down

0 comments on commit d73915e

Please sign in to comment.