Update canonical.go

This commit is contained in:
Justin 2025-11-27 00:12:06 +01:00 committed by GitHub
parent 7805e203f0
commit 02408244cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,7 +69,10 @@ func newCanonicalStore[T any](db ethdb.Iteratee, keyPrefix []byte) (*canonicalSt
// databaseKey returns the database key belonging to the given period. // databaseKey returns the database key belonging to the given period.
func (cs *canonicalStore[T]) databaseKey(period uint64) []byte { func (cs *canonicalStore[T]) databaseKey(period uint64) []byte {
return binary.BigEndian.AppendUint64(append([]byte{}, cs.keyPrefix...), period) key := make([]byte, len(cs.keyPrefix)+8)
copy(key, cs.keyPrefix)
binary.BigEndian.PutUint64(key[len(cs.keyPrefix):], period)
return key
} }
// add adds the given item to the database. It also ensures that the range remains // add adds the given item to the database. It also ensures that the range remains