Merge pull request #2983 from nikkolasg/feat/cachedrand

Use cache of verified drand values
This commit is contained in:
Łukasz Magiera 2020-08-11 18:34:14 +02:00 committed by GitHub
commit 01af855450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,6 +171,10 @@ func (db *DrandBeacon) VerifyEntry(curr types.BeaconEntry, prev types.BeaconEntr
// TODO handle genesis better // TODO handle genesis better
return nil return nil
} }
if be := db.getCachedValue(curr.Round); be != nil {
// return no error if the value is in the cache already
return nil
}
b := &dchain.Beacon{ b := &dchain.Beacon{
PreviousSig: prev.Data, PreviousSig: prev.Data,
Round: curr.Round, Round: curr.Round,