Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
@ -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{})
|
||||
|
Reference in New Issue
Block a user