(
t *testing.T,
n int,
activeVals map[string]struct{},
blocksSubs []types.Subscription,
css []*State,
txs ...[]byte,
)
| 599 | } |
| 600 | |
| 601 | func waitForAndValidateBlockWithTx( |
| 602 | t *testing.T, |
| 603 | n int, |
| 604 | activeVals map[string]struct{}, |
| 605 | blocksSubs []types.Subscription, |
| 606 | css []*State, |
| 607 | txs ...[]byte, |
| 608 | ) { |
| 609 | timeoutWaitGroup(t, n, func(j int) { |
| 610 | ntxs := 0 |
| 611 | BLOCK_TX_LOOP: |
| 612 | for { |
| 613 | css[j].Logger.Debug("waitForAndValidateBlockWithTx", "ntxs", ntxs) |
| 614 | msg := <-blocksSubs[j].Out() |
| 615 | newBlock := msg.Data().(types.EventDataNewBlock).Block |
| 616 | css[j].Logger.Debug("waitForAndValidateBlockWithTx: Got block", "height", newBlock.Height) |
| 617 | err := validateBlock(newBlock, activeVals) |
| 618 | assert.Nil(t, err) |
| 619 | |
| 620 | // check that txs match the txs we're waiting for. |
| 621 | // note they could be spread over multiple blocks, |
| 622 | // but they should be in order. |
| 623 | for _, tx := range newBlock.Data.Txs { |
| 624 | assert.EqualValues(t, txs[ntxs], tx) |
| 625 | ntxs++ |
| 626 | } |
| 627 | |
| 628 | if ntxs == len(txs) { |
| 629 | break BLOCK_TX_LOOP |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | }, css) |
| 634 | } |
| 635 | |
| 636 | func waitForBlockWithUpdatedValsAndValidateIt( |
| 637 | t *testing.T, |
no test coverage detected