core/rawdb: refactor db key prefix (#26000)

Co-authored-by: seven <seven@nodereal.io>
This commit is contained in:
s7v7nislands
2022-10-19 09:53:09 +02:00
committed by GitHub
co-authored by seven
parent 6069d8294e
commit d86fe26f67
6 changed files with 34 additions and 30 deletions
+3 -2
View File
@@ -23,6 +23,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
@@ -87,7 +88,7 @@ func newSnapshot(config *params.CliqueConfig, sigcache *lru.ARCCache, number uin
// loadSnapshot loads an existing snapshot from the database.
func loadSnapshot(config *params.CliqueConfig, sigcache *lru.ARCCache, db ethdb.Database, hash common.Hash) (*Snapshot, error) {
blob, err := db.Get(append([]byte("clique-"), hash[:]...))
blob, err := db.Get(append(rawdb.CliqueSnapshotPrefix, hash[:]...))
if err != nil {
return nil, err
}
@@ -107,7 +108,7 @@ func (s *Snapshot) store(db ethdb.Database) error {
if err != nil {
return err
}
return db.Put(append([]byte("clique-"), s.Hash[:]...), blob)
return db.Put(append(rawdb.CliqueSnapshotPrefix, s.Hash[:]...), blob)
}
// copy creates a deep copy of the snapshot, though not the individual votes.