Skip to content

Commit 3bb8a4e

Browse files
authored
Merge pull request #21425 from holiman/leslock
les: update checktime even if check fails
2 parents 68754f3 + 983cb25 commit 3bb8a4e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

les/checkpointoracle/oracle.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ func (oracle *CheckpointOracle) StableCheckpoint() (*params.TrustedCheckpoint, u
9393
// Look it up properly
9494
// Retrieve the latest checkpoint from the contract, abort if empty
9595
latest, hash, height, err := oracle.contract.Contract().GetLatestCheckpoint(nil)
96+
oracle.lastCheckTime = time.Now()
9697
if err != nil || (latest == 0 && hash == [32]byte{}) {
97-
return nil, 0
98+
oracle.lastCheckPointHeight = 0
99+
oracle.lastCheckPoint = nil
100+
return oracle.lastCheckPoint, oracle.lastCheckPointHeight
98101
}
99102
local := oracle.getLocal(latest)
100103

@@ -106,10 +109,9 @@ func (oracle *CheckpointOracle) StableCheckpoint() (*params.TrustedCheckpoint, u
106109
//
107110
// In both cases, no stable checkpoint will be returned.
108111
if local.HashEqual(hash) {
109-
oracle.lastCheckTime = time.Now()
110112
oracle.lastCheckPointHeight = height.Uint64()
111113
oracle.lastCheckPoint = &local
112-
return &local, height.Uint64()
114+
return oracle.lastCheckPoint, oracle.lastCheckPointHeight
113115
}
114116
return nil, 0
115117
}

0 commit comments

Comments
 (0)