OSDN Git Service

fix ci
[bytom/vapor.git] / protocol / block_test.go
index f028bbd..f60d439 100644 (file)
@@ -3,13 +3,25 @@ package protocol
 import (
        "testing"
 
+       "github.com/vapor/common"
        "github.com/vapor/config"
+       "github.com/vapor/consensus"
        "github.com/vapor/protocol/state"
        "github.com/vapor/testutil"
 )
 
 func TestCalcReorganizeNodes(t *testing.T) {
        c := &Chain{index: state.NewBlockIndex()}
+       config.CommonConfig = config.DefaultConfig()
+       config.CommonConfig.Consensus.Dpos.SelfVoteSigners = append(config.CommonConfig.Consensus.Dpos.SelfVoteSigners, "vsm1qkm743xmgnvh84pmjchq2s4tnfpgu9ae2f9slep")
+       config.CommonConfig.Consensus.Dpos.XPrv = "a8e281b615809046698fb0b0f2804a36d824d48fa443350f10f1b80649d39e5f1e85cf9855548915e36137345910606cbc8e7dd8497c831dce899ee6ac112445"
+       for _, v := range config.CommonConfig.Consensus.Dpos.SelfVoteSigners {
+               address, err := common.DecodeAddress(v, &consensus.SoloNetParams)
+               if err != nil {
+                       t.Fatal(err)
+               }
+               config.CommonConfig.Consensus.Dpos.Signers = append(config.CommonConfig.Consensus.Dpos.Signers, address)
+       }
        header := config.GenesisBlock().BlockHeader
        initNode, err := state.NewBlockNode(&header, nil)
        if err != nil {
@@ -23,7 +35,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)
@@ -37,7 +48,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)