core: fix broken stateroot storage
Store stateroot by DataMPTAux prefix instead of storing it by index only.
This commit is contained in:
parent
2c5fbd57fb
commit
8be6823cb1
2 changed files with 2 additions and 2 deletions
|
@ -277,7 +277,7 @@ func TestBlockchain_StartFromExistingDB(t *testing.T) {
|
|||
cache := storage.NewMemCachedStore(ps) // Extra wrapper to avoid good DB corruption.
|
||||
key := make([]byte, 5)
|
||||
key[0] = byte(storage.DataMPTAux)
|
||||
binary.BigEndian.PutUint32(key, h)
|
||||
binary.BigEndian.PutUint32(key[1:], h)
|
||||
cache.Delete(key)
|
||||
|
||||
_, _, _, err := chain.NewMultiWithCustomConfigAndStoreNoCheck(t, customConfig, cache)
|
||||
|
|
|
@ -51,7 +51,7 @@ func (s *Module) getStateRoot(key []byte) (*state.MPTRoot, error) {
|
|||
func makeStateRootKey(index uint32) []byte {
|
||||
key := make([]byte, 5)
|
||||
key[0] = byte(storage.DataMPTAux)
|
||||
binary.BigEndian.PutUint32(key, index)
|
||||
binary.BigEndian.PutUint32(key[1:], index)
|
||||
return key
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue