OSDN Git Service

modify miner block to propose block (#92)
[bytom/vapor.git] / protocol / block_test.go
index 608cbcd..6fcece8 100644 (file)
@@ -10,6 +10,7 @@ import (
 )
 
 func TestCalcReorganizeNodes(t *testing.T) {
+       config.CommonConfig = config.DefaultConfig()
        c := &Chain{index: state.NewBlockIndex()}
        header := config.GenesisBlock().BlockHeader
        initNode, err := state.NewBlockNode(&header, nil)
@@ -24,7 +25,6 @@ func TestCalcReorganizeNodes(t *testing.T) {
        mainChainNode := initNode
        for i := 1; i <= 7; i++ {
                header.Height = uint64(i)
-               header.Nonce = 0
                mainChainNode, err = state.NewBlockNode(&header, mainChainNode)
                if err != nil {
                        t.Fatal(err)
@@ -38,7 +38,6 @@ func TestCalcReorganizeNodes(t *testing.T) {
        sideChainNode := initNode
        for i := 1; i <= 13; i++ {
                header.Height = uint64(i)
-               header.Nonce = 1
                sideChainNode, err = state.NewBlockNode(&header, sideChainNode)
                if err != nil {
                        t.Fatal(err)
@@ -57,6 +56,7 @@ func TestCalcReorganizeNodes(t *testing.T) {
 }
 
 func TestEdgeCalcReorganizeNodes(t *testing.T) {
+       config.CommonConfig = config.DefaultConfig()
        header := config.GenesisBlock().BlockHeader
        initNode, err := state.NewBlockNode(&header, nil)
        if err != nil {
@@ -68,7 +68,6 @@ func TestEdgeCalcReorganizeNodes(t *testing.T) {
        for i := uint64(1); i <= 5; i++ {
                node := &state.BlockNode{
                        Height: i,
-                       Nonce:  0,
                        Hash:   bc.Hash{V0: uint64(i)},
                        Parent: testNodes[i-1],
                }
@@ -76,7 +75,6 @@ func TestEdgeCalcReorganizeNodes(t *testing.T) {
 
                newNode := &state.BlockNode{
                        Height: i,
-                       Nonce:  1,
                        Hash:   bc.Hash{V1: uint64(i)},
                        Parent: testNewNodes[i-1],
                }