aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-01-09 14:21:47 +0800
committerzelig <viktor.tron@gmail.com>2015-01-09 14:21:47 +0800
commitb3161f5803fdab9531c611659b7827ff1a2699dd (patch)
tree8e990b73858c4222d16a33c55119bf3ee56e2068 /core
parent5a9952c7b47f20451feea1158286450e08b85551 (diff)
parent26f066f0c7570bcca43299721c2b7a1a70186ee3 (diff)
downloadgo-tangerine-b3161f5803fdab9531c611659b7827ff1a2699dd.tar.gz
go-tangerine-b3161f5803fdab9531c611659b7827ff1a2699dd.tar.zst
go-tangerine-b3161f5803fdab9531c611659b7827ff1a2699dd.zip
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'core')
-rw-r--r--core/chain_manager.go4
-rw-r--r--core/chain_manager_test.go8
-rw-r--r--core/genesis.go1
3 files changed, 7 insertions, 6 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 0b5740622..3e0a3fb23 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -139,7 +139,7 @@ func (bc *ChainManager) setLastBlock() {
bc.Reset()
}
- chainlogger.Infof("Last block (#%d) %x\n", bc.lastBlockNumber, bc.currentBlock.Hash())
+ chainlogger.Infof("Last block (#%d) %x TD=%v\n", bc.lastBlockNumber, bc.currentBlock.Hash(), bc.td)
}
// Block creation & chain handling
@@ -215,7 +215,7 @@ func (bc *ChainManager) insert(block *types.Block) {
func (bc *ChainManager) write(block *types.Block) {
bc.writeBlockInfo(block)
- encodedBlock := ethutil.Encode(block)
+ encodedBlock := ethutil.Encode(block.RlpDataForStorage())
bc.db.Put(block.Hash(), encodedBlock)
}
diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go
index b384c4926..725352daf 100644
--- a/core/chain_manager_test.go
+++ b/core/chain_manager_test.go
@@ -1,10 +1,10 @@
package core
import (
+ "bytes"
"fmt"
"os"
"path"
- "reflect"
"runtime"
"strconv"
"testing"
@@ -76,11 +76,11 @@ func TestChainInsertions(t *testing.T) {
<-done
}
- if reflect.DeepEqual(chain2[len(chain2)-1], chainMan.CurrentBlock()) {
+ if bytes.Equal(chain2[len(chain2)-1].Hash(), chainMan.CurrentBlock().Hash()) {
t.Error("chain2 is canonical and shouldn't be")
}
- if !reflect.DeepEqual(chain1[len(chain1)-1], chainMan.CurrentBlock()) {
+ if !bytes.Equal(chain1[len(chain1)-1].Hash(), chainMan.CurrentBlock().Hash()) {
t.Error("chain1 isn't canonical and should be")
}
}
@@ -124,7 +124,7 @@ func TestChainMultipleInsertions(t *testing.T) {
<-done
}
- if !reflect.DeepEqual(chains[longest][len(chains[longest])-1], chainMan.CurrentBlock()) {
+ if !bytes.Equal(chains[longest][len(chains[longest])-1].Hash(), chainMan.CurrentBlock().Hash()) {
t.Error("Invalid canonical chain")
}
}
diff --git a/core/genesis.go b/core/genesis.go
index 1590818a8..d9edaace2 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -25,6 +25,7 @@ func GenesisBlock(db ethutil.Database) *types.Block {
genesis.Header().GasLimit = big.NewInt(1000000)
genesis.Header().GasUsed = ethutil.Big0
genesis.Header().Time = 0
+ genesis.Td = ethutil.Big0
genesis.SetUncles([]*types.Header{})
genesis.SetTransactions(types.Transactions{})