Skip to content

Commit

Permalink
fix databaseVersionKey
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Jan 21, 2025
1 parent fae9157 commit 3eda297
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/rawdb/accessors_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ import (
// ReadDatabaseVersion reads the version number from db.
func ReadDatabaseVersion(db ethdb.KeyValueReader) int {
var vsn uint
enc, _ := db.Get([]byte("BlockchainVersion"))
enc, _ := db.Get(databaseVersionKey)
rlp.DecodeBytes(enc, &vsn)
return int(vsn)
}

// WriteDatabaseVersion writes vsn as the version number to db.
func WriteDatabaseVersion(db ethdb.KeyValueWriter, vsn int) {
enc, _ := rlp.EncodeToBytes(uint(vsn))
db.Put([]byte("BlockchainVersion"), enc)
db.Put(databaseVersionKey, enc)
}

// ReadChainConfig will fetch the network settings based on the given hash.
Expand Down
3 changes: 3 additions & 0 deletions core/rawdb/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import (

// The fields below define the low level database schema prefixing.
var (
// databaseVersionKey tracks the current database version.
databaseVersionKey = []byte("DatabaseVersion")

// headHeaderKey tracks the latest known header's hash.
headHeaderKey = []byte("LastHeader")

Expand Down

0 comments on commit 3eda297

Please sign in to comment.