Skip to content

Commit 60df2fa

Browse files
committed
fix: open strorage trie param error
1 parent bb167a9 commit 60df2fa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/state/caching_versa_db.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,19 @@ func (cv *cachingVersaDB) OpenStorageTrie(stateRoot common.Hash, address common.
134134
//TODO:: will change to log.Error after stabilization
135135
panic("open account tree, before open storage tree")
136136
}
137-
if cv.root.Cmp(root) != 0 {
138-
panic("account root mismatch, on open storage tree")
137+
if cv.root.Cmp(stateRoot) != 0 {
138+
panic(fmt.Sprintf("account root mismatch, on open storage tree, actual: %s, expect: %s", root.String(), cv.root.String()))
139139
}
140140

141141
version, account, err := cv.accTree.getAccountWithVersion(address)
142142
if err != nil {
143143
return nil, err
144144
}
145-
if account.Root.Cmp(stateRoot) != 0 {
145+
if account.Root.Cmp(root) != 0 {
146146
return nil, fmt.Errorf("state root mismatch")
147147
}
148148

149-
handler, err := cv.versionDB.OpenTree(cv.state, version, crypto.Keccak256Hash(address.Bytes()), stateRoot)
149+
handler, err := cv.versionDB.OpenTree(cv.state, version, crypto.Keccak256Hash(address.Bytes()), root)
150150
if err != nil {
151151
return nil, err
152152
}
@@ -251,8 +251,8 @@ type VersaTree struct {
251251
accountTree bool
252252

253253
// TODO:: debugging, used for logging
254-
root common.Hash
255254
stateRoot common.Hash
255+
root common.Hash
256256
address common.Address
257257
}
258258

0 commit comments

Comments
 (0)