Skip to content

Commit

Permalink
fix: open strorage trie param error
Browse files Browse the repository at this point in the history
  • Loading branch information
joeylichang committed Aug 13, 2024
1 parent bb167a9 commit 60df2fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/state/caching_versa_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,19 @@ func (cv *cachingVersaDB) OpenStorageTrie(stateRoot common.Hash, address common.
//TODO:: will change to log.Error after stabilization
panic("open account tree, before open storage tree")
}
if cv.root.Cmp(root) != 0 {
panic("account root mismatch, on open storage tree")
if cv.root.Cmp(stateRoot) != 0 {
panic(fmt.Sprintf("account root mismatch, on open storage tree, actual: %s, expect: %s", root.String(), cv.root.String()))
}

version, account, err := cv.accTree.getAccountWithVersion(address)
if err != nil {
return nil, err
}
if account.Root.Cmp(stateRoot) != 0 {
if account.Root.Cmp(root) != 0 {
return nil, fmt.Errorf("state root mismatch")
}

handler, err := cv.versionDB.OpenTree(cv.state, version, crypto.Keccak256Hash(address.Bytes()), stateRoot)
handler, err := cv.versionDB.OpenTree(cv.state, version, crypto.Keccak256Hash(address.Bytes()), root)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -251,8 +251,8 @@ type VersaTree struct {
accountTree bool

// TODO:: debugging, used for logging
root common.Hash
stateRoot common.Hash
root common.Hash
address common.Address
}

Expand Down

0 comments on commit 60df2fa

Please sign in to comment.