bad merging caused this to get missed. my bad
This commit is contained in:
parent
09539f9322
commit
df5088ea77
@ -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) {
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user