events: Test 2 block tipsets with duplicated message

This commit is contained in:
Łukasz Magiera 2019-11-08 21:25:02 +01:00
parent aaa073bdf8
commit f3ae7eb7a3

View File

@ -46,11 +46,24 @@ func (fcs *fakeCS) ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet
func makeTs(t *testing.T, h uint64, msgcid cid.Cid) *types.TipSet { func makeTs(t *testing.T, h uint64, msgcid cid.Cid) *types.TipSet {
a, _ := address.NewFromString("t00") a, _ := address.NewFromString("t00")
b, _ := address.NewFromString("t02")
ts, err := types.NewTipSet([]*types.BlockHeader{ ts, err := types.NewTipSet([]*types.BlockHeader{
{ {
Height: h, Height: h,
Miner: a, Miner: a,
Tickets: []*types.Ticket{{[]byte{byte(h % 2)}}},
ParentStateRoot: dummyCid,
Messages: msgcid,
ParentMessageReceipts: dummyCid,
},
{
Height: h,
Miner: b,
Tickets: []*types.Ticket{{[]byte{byte((h + 1) % 2)}}},
ParentStateRoot: dummyCid, ParentStateRoot: dummyCid,
Messages: msgcid, Messages: msgcid,
ParentMessageReceipts: dummyCid, ParentMessageReceipts: dummyCid,
@ -494,6 +507,7 @@ func TestCalled(t *testing.T) {
err = events.Called(func(ts *types.TipSet) (d bool, m bool, e error) { err = events.Called(func(ts *types.TipSet) (d bool, m bool, e error) {
return false, true, nil return false, true, nil
}, func(msg *types.Message, ts *types.TipSet, curH uint64) (bool, error) { }, func(msg *types.Message, ts *types.TipSet, curH uint64) (bool, error) {
require.Equal(t, false, applied)
applied = true applied = true
appliedMsg = msg appliedMsg = msg
appliedTs = ts appliedTs = ts