diff --git a/ledger/chain/chain_test.go b/ledger/chain/chain_test.go index d1c6d3880..78e3f78b3 100644 --- a/ledger/chain/chain_test.go +++ b/ledger/chain/chain_test.go @@ -326,15 +326,6 @@ func TestCheckHash2(t *testing.T) { func TestChainForkRollBack(t *testing.T) { c, accountMap, _ := SetUp(t, 3, 100, 2) curSnapshotBlock := c.GetLatestSnapshotBlock() - fmt.Println(curSnapshotBlock.Height) - TearDown(c) - - // height - height := uint64(30) - upgrade.CleanupUpgradeBox() - upgrade.InitUpgradeBox(upgrade.NewEmptyUpgradeBox().AddPoint(1, height)) - - c, accountMap, _ = SetUp(t, 10, 0, 0) defer func() { TearDown(c) @@ -343,12 +334,8 @@ func TestChainForkRollBack(t *testing.T) { } }() - curSnapshotBlocknew := c.GetLatestSnapshotBlock() - - fmt.Println(curSnapshotBlocknew.Height, curSnapshotBlocknew.Height == height-1) - if curSnapshotBlocknew.Height != height-1 { - t.Fatal(fmt.Sprintf("not equal %+v, %d", curSnapshotBlocknew, height-1)) - } + upgrade.CleanupUpgradeBox() + upgrade.InitUpgradeBox(upgrade.NewEmptyUpgradeBox().AddPoint(1, curSnapshotBlock.Height+1)) InsertAccountBlocks(nil, c, accountMap, 5) @@ -377,8 +364,8 @@ func TestChainForkRollBack(t *testing.T) { return sc } sb := &ledger.SnapshotBlock{ - PrevHash: curSnapshotBlocknew.Hash, - Height: curSnapshotBlocknew.Height + 1, + PrevHash: curSnapshotBlock.Hash, + Height: curSnapshotBlock.Height + 1, Timestamp: &timeNow, SnapshotContent: createSnaoshotContent(), } diff --git a/producer/producer_test.go b/producer/producer_test.go index c144c7a99..3e159910e 100644 --- a/producer/producer_test.go +++ b/producer/producer_test.go @@ -47,11 +47,11 @@ func TestSnapshot(t *testing.T) { helper.ErrFailf(t, err, "random account err") - sv := verifier.NewSnapshotVerifier(c, cs) + // sv := verifier.NewSnapshotVerifier(c, cs) av := verifier.NewVerifier(c).Init(cs, cs.SBPReader(), nil) p := NewProducer(c, net.Mock(c), coinbase, cs, p1) - p1.Init(net.Mock(c), sv, av, cs.SBPReader().GetPeriodTimeIndex(), cs.SBPReader().GetNodeCount()) + p1.Init(net.Mock(c), av, cs.SBPReader()) p.Init() address := coinbase.Address() @@ -94,13 +94,13 @@ func TestProducer_Init(t *testing.T) { p1, _ := pool.NewPool(c) coinbase, _ := wallet.RandomAccount() cs := genConsensus(c, p1, t) - sv := verifier.NewSnapshotVerifier(c, cs) + // sv := verifier.NewSnapshotVerifier(c, cs) av := verifier.NewVerifier(c).Init(cs, cs.SBPReader(), nil) p := NewProducer(c, net.Mock(c), coinbase, cs, p1) c.Start() - p1.Init(net.Mock(c), sv, av, cs.SBPReader().GetPeriodTimeIndex(), cs.SBPReader().GetNodeCount()) + p1.Init(net.Mock(c), av, cs.SBPReader()) p.Init() p1.Start() p.Start()