Skip to content

Commit

Permalink
debug 3
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzckck committed Jul 1, 2024
1 parent df4c135 commit 896f51f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ func ReadAllCanonicalHashes(db ethdb.Iteratee, from uint64, to uint64, limit int

// ReadHeaderNumber returns the header number assigned to a hash.
func ReadHeaderNumber(db ethdb.KeyValueReader, hash common.Hash) *uint64 {
data, _ := db.Get(headerNumberKey(hash))
data, _ := db.Get(headerNumberKey(hash)) // db?
if len(data) != 8 {
log.Info("ReadHeaderNumber failed", "hash", hash)
log.Info("ReadHeaderNumber failed", "hash", hash, "len(data)", len(data))
return nil
}
number := binary.BigEndian.Uint64(data)
Expand All @@ -156,9 +156,9 @@ func ReadHeaderNumber(db ethdb.KeyValueReader, hash common.Hash) *uint64 {

// WriteHeaderNumber stores the hash->number mapping.
func WriteHeaderNumber(db ethdb.KeyValueWriter, hash common.Hash, number uint64) {
key := headerNumberKey(hash)
log.Info("WriteHeaderNumber", "hash", hash, "number", number)
key := headerNumberKey(hash) // db?
enc := encodeBlockNumber(number)
log.Info("WriteHeaderNumber", "hash", hash, "number", number)
if err := db.Put(key, enc); err != nil {
log.Crit("Failed to store hash to number mapping", "err", err)
}
Expand Down

0 comments on commit 896f51f

Please sign in to comment.