all: fix go vet warnings

This commit is contained in:
Felix Lange
2016-04-15 11:06:57 +02:00
parent 68c755a238
commit 6fdd0893c3
41 changed files with 83 additions and 93 deletions

View File

@ -61,6 +61,4 @@ func Disassemble(script []byte) (asm []string) {
pc.Add(pc, common.Big1)
}
return asm
}

View File

@ -993,7 +993,7 @@ func (self *BlockChain) reorg(oldBlock, newBlock *types.Block) error {
// first reduce whoever is higher bound
if oldBlock.NumberU64() > newBlock.NumberU64() {
// reduce old chain
for oldBlock = oldBlock; oldBlock != nil && oldBlock.NumberU64() != newBlock.NumberU64(); oldBlock = self.GetBlock(oldBlock.ParentHash()) {
for ; oldBlock != nil && oldBlock.NumberU64() != newBlock.NumberU64(); oldBlock = self.GetBlock(oldBlock.ParentHash()) {
oldChain = append(oldChain, oldBlock)
deletedTxs = append(deletedTxs, oldBlock.Transactions()...)
@ -1001,7 +1001,7 @@ func (self *BlockChain) reorg(oldBlock, newBlock *types.Block) error {
}
} else {
// reduce new chain and append new chain blocks for inserting later on
for newBlock = newBlock; newBlock != nil && newBlock.NumberU64() != oldBlock.NumberU64(); newBlock = self.GetBlock(newBlock.ParentHash()) {
for ; newBlock != nil && newBlock.NumberU64() != oldBlock.NumberU64(); newBlock = self.GetBlock(newBlock.ParentHash()) {
newChain = append(newChain, newBlock)
}
}

View File

@ -145,7 +145,7 @@ func testIterativeStateSync(t *testing.T, batch int) {
if err != nil {
t.Fatalf("failed to retrieve node data for %x: %v", hash, err)
}
results[i] = trie.SyncResult{hash, data}
results[i] = trie.SyncResult{Hash: hash, Data: data}
}
if index, err := sched.Process(results); err != nil {
t.Fatalf("failed to process result #%d: %v", index, err)
@ -175,7 +175,7 @@ func TestIterativeDelayedStateSync(t *testing.T) {
if err != nil {
t.Fatalf("failed to retrieve node data for %x: %v", hash, err)
}
results[i] = trie.SyncResult{hash, data}
results[i] = trie.SyncResult{Hash: hash, Data: data}
}
if index, err := sched.Process(results); err != nil {
t.Fatalf("failed to process result #%d: %v", index, err)
@ -212,7 +212,7 @@ func testIterativeRandomStateSync(t *testing.T, batch int) {
if err != nil {
t.Fatalf("failed to retrieve node data for %x: %v", hash, err)
}
results = append(results, trie.SyncResult{hash, data})
results = append(results, trie.SyncResult{Hash: hash, Data: data})
}
// Feed the retrieved results back and queue new tasks
if index, err := sched.Process(results); err != nil {
@ -251,7 +251,7 @@ func TestIterativeRandomDelayedStateSync(t *testing.T) {
if err != nil {
t.Fatalf("failed to retrieve node data for %x: %v", hash, err)
}
results = append(results, trie.SyncResult{hash, data})
results = append(results, trie.SyncResult{Hash: hash, Data: data})
if len(results) >= cap(results) {
break
@ -289,7 +289,7 @@ func TestIncompleteStateSync(t *testing.T) {
if err != nil {
t.Fatalf("failed to retrieve node data for %x: %v", hash, err)
}
results[i] = trie.SyncResult{hash, data}
results[i] = trie.SyncResult{Hash: hash, Data: data}
}
// Process each of the state nodes
if index, err := sched.Process(results); err != nil {

View File

@ -58,6 +58,4 @@ func Disassemble(script []byte) (asm []string) {
pc.Add(pc, common.Big1)
}
return
}

View File

@ -77,7 +77,7 @@ func TestParser(t *testing.T) {
t.Fatal("empty output")
}
if output[0] != test.output {
t.Error("%v failed: expected %v but got %v", test.base+OpCode(i), output[0])
t.Errorf("%v failed: expected %v but got %v", test.base+OpCode(i), test.output, output[0])
}
}
}