mirror of https://github.com/status-im/op-geth.git
Fixed issue with Storage()
* Storage() returned encoded values. They are now decode prior to hexing * Removed old code from state object * Updated coin
This commit is contained in:
parent
705cf6113d
commit
54927dc0e0
|
@ -65,9 +65,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var contract = web3.eth.contract(address, desc);
|
var contract = web3.eth.contract(address, desc);
|
||||||
document.querySelector("#balance").innerHTML = contract.call().balance(eth.coinbase);
|
|
||||||
|
|
||||||
function reflesh() {
|
function reflesh() {
|
||||||
|
document.querySelector("#balance").innerHTML = contract.call().balance(eth.coinbase);
|
||||||
|
|
||||||
var table = document.querySelector("#table");
|
var table = document.querySelector("#table");
|
||||||
table.innerHTML = ""; // clear
|
table.innerHTML = ""; // clear
|
||||||
|
|
||||||
|
|
|
@ -121,26 +121,6 @@ func (self *StateObject) SetState(k []byte, value *ethutil.Value) {
|
||||||
self.storage[string(key)] = value.Copy()
|
self.storage[string(key)] = value.Copy()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// Iterate over each storage address and yield callback
|
|
||||||
func (self *StateObject) EachStorage(cb trie.EachCallback) {
|
|
||||||
// First loop over the uncommit/cached values in storage
|
|
||||||
for key, value := range self.storage {
|
|
||||||
// XXX Most iterators Fns as it stands require encoded values
|
|
||||||
encoded := ethutil.NewValue(value.Encode())
|
|
||||||
cb(key, encoded)
|
|
||||||
}
|
|
||||||
|
|
||||||
it := self.State.Trie.NewIterator()
|
|
||||||
it.Each(func(key string, value *ethutil.Value) {
|
|
||||||
// If it's cached don't call the callback.
|
|
||||||
if self.storage[key] == nil {
|
|
||||||
cb(key, value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func (self *StateObject) Sync() {
|
func (self *StateObject) Sync() {
|
||||||
for key, value := range self.storage {
|
for key, value := range self.storage {
|
||||||
if value.Len() == 0 {
|
if value.Len() == 0 {
|
||||||
|
@ -150,15 +130,6 @@ func (self *StateObject) Sync() {
|
||||||
|
|
||||||
self.setAddr([]byte(key), value)
|
self.setAddr([]byte(key), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
valid, t2 := trie.ParanoiaCheck(self.State.trie, ethutil.Config.Db)
|
|
||||||
if !valid {
|
|
||||||
statelogger.Infof("Warn: PARANOIA: Different state storage root during copy %x vs %x\n", self.State.Root(), t2.Root())
|
|
||||||
|
|
||||||
self.State.trie = t2
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StateObject) GetInstr(pc *big.Int) *ethutil.Value {
|
func (c *StateObject) GetInstr(pc *big.Int) *ethutil.Value {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package xeth
|
package xeth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -9,6 +10,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
"github.com/ethereum/go-ethereum/p2p"
|
"github.com/ethereum/go-ethereum/p2p"
|
||||||
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/state"
|
"github.com/ethereum/go-ethereum/state"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,8 +56,11 @@ func (self *Object) Storage() (storage map[string]string) {
|
||||||
|
|
||||||
it := self.StateObject.Trie().Iterator()
|
it := self.StateObject.Trie().Iterator()
|
||||||
for it.Next() {
|
for it.Next() {
|
||||||
storage[toHex(it.Key)] = toHex(it.Value)
|
var data []byte
|
||||||
|
rlp.Decode(bytes.NewReader(it.Value), &data)
|
||||||
|
storage[toHex(it.Key)] = toHex(data)
|
||||||
}
|
}
|
||||||
|
self.StateObject.Trie().PrintRoot()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue