Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions yarn-project/p2p/src/client/p2p_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,17 @@ describe('P2P Client', () => {

it('triggers tx collection for missing txs from mined blocks', async () => {
await client.start();
// Drain any initial background sync that processes the initial blocks (1-100),
// which may call startCollecting depending on timing.
await client.sync();

const block = await L2Block.random(BlockNumber(101), { txsPerBlock: 3 });
// Compute the block hash since it gets cached when the p2p client logs it
await block.hash();

txPool.hasTxs.mockResolvedValue([true, false, true]);
blockSource.addProposedBlocks([block]);
txCollection.startCollecting.mockClear();
await client.sync();

expect(txCollection.startCollecting).toHaveBeenCalledTimes(1);
Expand Down
Loading