mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 07:37:20 +00:00
beacon/light: optimize database key assembling (#33292)
This commit is contained in:
parent
7805e203f0
commit
6452b7ad05
1 changed files with 4 additions and 1 deletions
|
|
@ -69,7 +69,10 @@ func newCanonicalStore[T any](db ethdb.Iteratee, keyPrefix []byte) (*canonicalSt
|
|||
|
||||
// databaseKey returns the database key belonging to the given period.
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue