mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-26 18:04:22 +00:00
major flippage for vm addrs. now left padded words for tx_cache
This commit is contained in:
@@ -91,13 +91,13 @@ func (cache *BlockCache) GetStorage(addr Word256, key Word256) (value Word256) {
|
||||
}
|
||||
|
||||
// Get or load storage
|
||||
acc, storage, removed, dirty := cache.accounts[string(addr.Prefix(20))].unpack()
|
||||
acc, storage, removed, dirty := cache.accounts[string(addr.Postfix(20))].unpack()
|
||||
if removed {
|
||||
panic("GetStorage() on removed account")
|
||||
}
|
||||
if acc != nil && storage == nil {
|
||||
storage = makeStorage(cache.db, acc.StorageRoot)
|
||||
cache.accounts[string(addr.Prefix(20))] = accountInfo{acc, storage, false, dirty}
|
||||
cache.accounts[string(addr.Postfix(20))] = accountInfo{acc, storage, false, dirty}
|
||||
} else if acc == nil {
|
||||
return Zero256
|
||||
}
|
||||
@@ -114,7 +114,7 @@ func (cache *BlockCache) GetStorage(addr Word256, key Word256) (value Word256) {
|
||||
|
||||
// NOTE: Set value to zero to removed from the trie.
|
||||
func (cache *BlockCache) SetStorage(addr Word256, key Word256, value Word256) {
|
||||
_, _, removed, _ := cache.accounts[string(addr.Prefix(20))].unpack()
|
||||
_, _, removed, _ := cache.accounts[string(addr.Postfix(20))].unpack()
|
||||
if removed {
|
||||
panic("SetStorage() on a removed account")
|
||||
}
|
||||
@@ -146,7 +146,7 @@ func (cache *BlockCache) Sync() {
|
||||
for _, storageKey := range storageKeys {
|
||||
addr, key := Tuple256Split(storageKey)
|
||||
if addr != curAddr || curAcc == nil {
|
||||
acc, storage, removed, _ := cache.accounts[string(addr.Prefix(20))].unpack()
|
||||
acc, storage, removed, _ := cache.accounts[string(addr.Postfix(20))].unpack()
|
||||
if storage == nil {
|
||||
storage = makeStorage(cache.db, acc.StorageRoot)
|
||||
}
|
||||
@@ -166,7 +166,7 @@ func (cache *BlockCache) Sync() {
|
||||
curStorage.Remove(key.Bytes())
|
||||
} else {
|
||||
curStorage.Set(key.Bytes(), value.Bytes())
|
||||
cache.accounts[string(addr.Prefix(20))] = accountInfo{curAcc, curStorage, false, true}
|
||||
cache.accounts[string(addr.Postfix(20))] = accountInfo{curAcc, curStorage, false, true}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user