From df5088ea77e1d8bd52a8e8e82c8cfc0394802506 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Mon, 5 Aug 2019 12:27:26 -0700 Subject: [PATCH] bad merging caused this to get missed. my bad --- chain/gen/gen.go | 18 +++++++++--------- chain/gen/gen_test.go | 2 +- chain/sync_test.go | 13 ++++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/chain/gen/gen.go b/chain/gen/gen.go index 42ddd010c..24c724976 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -170,10 +170,10 @@ func (cg *ChainGen) nextBlockProof() (address.Address, types.ElectionProof, []ty return cg.miner, []byte("cat in a box"), []types.Ticket{types.Ticket("im a ticket, promise")}, nil } -func (cg *ChainGen) NextBlock() (*types.FullBlock, error) { +func (cg *ChainGen) NextBlock() (*types.FullBlock, []*types.SignedMessage, error) { miner, proof, tickets, err := cg.nextBlockProof() if err != nil { - return nil, err + return nil, nil, err } // make some transfers from banker @@ -196,12 +196,12 @@ func (cg *ChainGen) NextBlock() (*types.FullBlock, error) { unsigned, err := msg.Serialize() if err != nil { - return nil, err + return nil, nil, err } sig, err := cg.w.Sign(cg.banker, unsigned) if err != nil { - return &types.FullBlock{}, err + return nil, nil, err } msgs[m] = &types.SignedMessage{ @@ -210,7 +210,7 @@ func (cg *ChainGen) NextBlock() (*types.FullBlock, error) { } if _, err := cg.cs.PutMessage(msgs[m]); err != nil { - return nil, err + return nil, nil, err } } @@ -218,21 +218,21 @@ func (cg *ChainGen) NextBlock() (*types.FullBlock, error) { parents, err := types.NewTipSet([]*types.BlockHeader{cg.curBlock.Header}) if err != nil { - return nil, err + return nil, nil, err } fblk, err := MinerCreateBlock(context.TODO(), cg.cs, miner, parents, tickets, proof, msgs) if err != nil { - return nil, err + return nil, nil, err } if err := cg.cs.AddBlock(fblk.Header); err != nil { - return nil, err + return nil, nil, err } cg.curBlock = fblk - return fblk, nil + return fblk, msgs, nil } func (cg *ChainGen) YieldRepo() (repo.Repo, error) { diff --git a/chain/gen/gen_test.go b/chain/gen/gen_test.go index 3fd8ec58b..73333f238 100644 --- a/chain/gen/gen_test.go +++ b/chain/gen/gen_test.go @@ -11,7 +11,7 @@ func testGeneration(t testing.TB, n int) { } for i := 0; i < n; i++ { - b, err := g.NextBlock() + b, _, err := g.NextBlock() if err != nil { t.Fatalf("error at H:%d, %s", i, err) } diff --git a/chain/sync_test.go b/chain/sync_test.go index 5387000d0..bb306fffb 100644 --- a/chain/sync_test.go +++ b/chain/sync_test.go @@ -27,7 +27,7 @@ func (tu *syncTestUtil) repoWithChain(t *testing.T, h int) (repo.Repo, []byte, [ for i := 0; i < h; i++ { var err error - blks[i], err = tu.g.NextBlock() + blks[i], _, err = tu.g.NextBlock() require.NoError(t, err) fmt.Printf("block at H:%d: %s\n", blks[i].Header.Height, blks[i].Cid()) @@ -84,10 +84,10 @@ func prepSyncTest(t *testing.T, h int) *syncTestUtil { } func (tu *syncTestUtil) mineNewBlock(src int) { - fblk, err := tu.g.NextBlock() + fblk, msgs, err := tu.g.NextBlock() require.NoError(tu.t, err) - for _, msg := range fblk.Messages { + for _, msg := range msgs { require.NoError(tu.t, tu.nds[src].MpoolPush(context.TODO(), msg)) } @@ -99,8 +99,11 @@ func fblkToBlkMsg(fb *types.FullBlock) *chain.BlockMsg { Header: fb.Header, } - for _, msg := range fb.Messages { - out.Messages = append(out.Messages, msg.Cid()) + for _, msg := range fb.BlsMessages { + out.BlsMessages = append(out.BlsMessages, msg.Cid()) + } + for _, msg := range fb.SecpkMessages { + out.SecpkMessages = append(out.SecpkMessages, msg.Cid()) } return out }