From 14e2e488fdf0f4d6ed1a5a48ffbbe883faa7edb6 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 19 Nov 2014 12:25:52 +0100 Subject: Added `chain` tests & minor fixes * Fork tests (equal and larger chains) * `chain.link` fields are now exported * moved debug function from state to dump.go --- state/dump.go | 8 ++++++++ state/state_object.go | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'state') diff --git a/state/dump.go b/state/dump.go index be3b362c4..186c6dd73 100644 --- a/state/dump.go +++ b/state/dump.go @@ -46,3 +46,11 @@ func (self *State) Dump() []byte { return json } + +// Debug stuff +func (self *StateObject) CreateOutputForDiff() { + fmt.Printf("%x %x %x %x\n", self.Address(), self.State.Root(), self.balance.Bytes(), self.Nonce) + self.EachStorage(func(addr string, value *ethutil.Value) { + fmt.Printf("%x %x\n", addr, value.Bytes()) + }) +} diff --git a/state/state_object.go b/state/state_object.go index 5ce74c434..729e32ae4 100644 --- a/state/state_object.go +++ b/state/state_object.go @@ -287,14 +287,6 @@ func (self *StateObject) Root() []byte { return self.State.Trie.GetRoot() } -// Debug stuff -func (self *StateObject) CreateOutputForDiff() { - fmt.Printf("%x %x %x %x\n", self.Address(), self.State.Root(), self.balance.Bytes(), self.Nonce) - self.EachStorage(func(addr string, value *ethutil.Value) { - fmt.Printf("%x %x\n", addr, value.Bytes()) - }) -} - // // Encoding // -- cgit v1.2.3 From e70529a97785012368e7e0d5b272cccab705e551 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 19 Nov 2014 15:05:08 +0100 Subject: Added new iterator and tests --- state/state_object.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'state') diff --git a/state/state_object.go b/state/state_object.go index 729e32ae4..f02d1b5ab 100644 --- a/state/state_object.go +++ b/state/state_object.go @@ -148,9 +148,7 @@ func (self *StateObject) EachStorage(cb trie.EachCallback) { func (self *StateObject) Sync() { for key, value := range self.storage { - if value.Len() == 0 { // value.BigInt().Cmp(ethutil.Big0) == 0 { - //data := self.getStorage([]byte(key)) - //fmt.Printf("deleting %x %x 0x%x\n", self.Address(), []byte(key), data) + if value.Len() == 0 { self.State.Trie.Delete(string(key)) continue } -- cgit v1.2.3