diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-01-07 01:30:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-07 01:30:44 +0800 |
commit | ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632 (patch) | |
tree | 2b06aa1b360f1488264058d04e399e84b898f0d8 /core/state | |
parent | 444fc892b0a860218dab3e421d92c33408b9eb6d (diff) | |
parent | 13e3b2f433c48fe81423c1a13e9a5194ece61b01 (diff) | |
download | go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.gz go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.bz2 go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.lz go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.xz go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.zst go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.zip |
Merge pull request #3525 from fjl/all-gosimple-cleanup
all: clean up lint issues, remove more dead code
Diffstat (limited to 'core/state')
-rw-r--r-- | core/state/iterator.go | 2 | ||||
-rw-r--r-- | core/state/iterator_test.go | 2 | ||||
-rw-r--r-- | core/state/managed_state_test.go | 6 | ||||
-rw-r--r-- | core/state/statedb.go | 6 | ||||
-rw-r--r-- | core/state/sync_test.go | 8 |
5 files changed, 12 insertions, 12 deletions
diff --git a/core/state/iterator.go b/core/state/iterator.go index 14265b277..a58a15ad3 100644 --- a/core/state/iterator.go +++ b/core/state/iterator.go @@ -123,7 +123,7 @@ func (it *NodeIterator) step() error { if !it.dataIt.Next() { it.dataIt = nil } - if bytes.Compare(account.CodeHash, emptyCodeHash) != 0 { + if !bytes.Equal(account.CodeHash, emptyCodeHash) { it.codeHash = common.BytesToHash(account.CodeHash) it.code, err = it.state.db.Get(account.CodeHash) if err != nil { diff --git a/core/state/iterator_test.go b/core/state/iterator_test.go index aa05c5dfe..aa9c5b728 100644 --- a/core/state/iterator_test.go +++ b/core/state/iterator_test.go @@ -41,7 +41,7 @@ func TestNodeIteratorCoverage(t *testing.T) { } } // Cross check the hashes and the database itself - for hash, _ := range hashes { + for hash := range hashes { if _, err := db.Get(hash.Bytes()); err != nil { t.Errorf("failed to retrieve reported node %x: %v", hash, err) } diff --git a/core/state/managed_state_test.go b/core/state/managed_state_test.go index 3f7bc2aa8..d9c232ebb 100644 --- a/core/state/managed_state_test.go +++ b/core/state/managed_state_test.go @@ -52,7 +52,7 @@ func TestRemove(t *testing.T) { ms, account := create() nn := make([]bool, 10) - for i, _ := range nn { + for i := range nn { nn[i] = true } account.nonces = append(account.nonces, nn...) @@ -68,7 +68,7 @@ func TestReuse(t *testing.T) { ms, account := create() nn := make([]bool, 10) - for i, _ := range nn { + for i := range nn { nn[i] = true } account.nonces = append(account.nonces, nn...) @@ -84,7 +84,7 @@ func TestReuse(t *testing.T) { func TestRemoteNonceChange(t *testing.T) { ms, account := create() nn := make([]bool, 10) - for i, _ := range nn { + for i := range nn { nn[i] = true } account.nonces = append(account.nonces, nn...) diff --git a/core/state/statedb.go b/core/state/statedb.go index bbcde9443..75c40b364 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -479,7 +479,7 @@ func (self *StateDB) Copy() *StateDB { logSize: self.logSize, } // Copy the dirty states and logs - for addr, _ := range self.stateObjectsDirty { + for addr := range self.stateObjectsDirty { state.stateObjects[addr] = self.stateObjects[addr].deepCopy(state, state.MarkStateObjectDirty) state.stateObjectsDirty[addr] = struct{}{} } @@ -530,7 +530,7 @@ func (self *StateDB) GetRefund() *big.Int { // It is called in between transactions to get the root hash that // goes into transaction receipts. func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash { - for addr, _ := range s.stateObjectsDirty { + for addr := range s.stateObjectsDirty { stateObject := s.stateObjects[addr] if stateObject.suicided || (deleteEmptyObjects && stateObject.empty()) { s.deleteStateObject(stateObject) @@ -553,7 +553,7 @@ func (s *StateDB) DeleteSuicides() { // Reset refund so that any used-gas calculations can use this method. s.clearJournalAndRefund() - for addr, _ := range s.stateObjectsDirty { + for addr := range s.stateObjectsDirty { stateObject := s.stateObjects[addr] // If the object has been removed by a suicide diff --git a/core/state/sync_test.go b/core/state/sync_test.go index 2a30c86f4..43d146e3a 100644 --- a/core/state/sync_test.go +++ b/core/state/sync_test.go @@ -84,7 +84,7 @@ func checkStateAccounts(t *testing.T, db ethdb.Database, root common.Hash, accou if nonce := state.GetNonce(acc.address); nonce != acc.nonce { t.Errorf("account %d: nonce mismatch: have %v, want %v", i, nonce, acc.nonce) } - if code := state.GetCode(acc.address); bytes.Compare(code, acc.code) != 0 { + if code := state.GetCode(acc.address); !bytes.Equal(code, acc.code) { t.Errorf("account %d: code mismatch: have %x, want %x", i, code, acc.code) } } @@ -198,7 +198,7 @@ func testIterativeRandomStateSync(t *testing.T, batch int) { for len(queue) > 0 { // Fetch all the queued nodes in a random order results := make([]trie.SyncResult, 0, len(queue)) - for hash, _ := range queue { + for hash := range queue { data, err := srcDb.Get(hash.Bytes()) if err != nil { t.Fatalf("failed to retrieve node data for %x: %v", hash, err) @@ -235,7 +235,7 @@ func TestIterativeRandomDelayedStateSync(t *testing.T) { for len(queue) > 0 { // Sync only half of the scheduled nodes, even those in random order results := make([]trie.SyncResult, 0, len(queue)/2+1) - for hash, _ := range queue { + for hash := range queue { delete(queue, hash) data, err := srcDb.Get(hash.Bytes()) @@ -294,7 +294,7 @@ func TestIncompleteStateSync(t *testing.T) { // Skim through the accounts and make sure the root hash is not a code node codeHash := false for _, acc := range srcAccounts { - if bytes.Compare(root.Bytes(), crypto.Sha3(acc.code)) == 0 { + if root == crypto.Keccak256Hash(acc.code) { codeHash = true break } |