Skip to content

Commit

Permalink
fix: Don't retransmit txs upon node restart (#11123)
Browse files Browse the repository at this point in the history
A long time ago, the node was written such that it would broadcast all
txs in it's pool after a restart. This seems unnecessary now and can
cause lib-p2p errors when it does so. Removed.
  • Loading branch information
PhilWindle authored Jan 9, 2025
1 parent 2a77616 commit 39535c9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
11 changes: 0 additions & 11 deletions yarn-project/p2p/src/client/p2p_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,6 @@ describe('In-Memory P2P Client', () => {
expect(txPool.addTxs).toHaveBeenCalledTimes(2);
});

it('republishes previously stored txs on start', async () => {
const tx1 = mockTx();
const tx2 = mockTx();
txPool.getAllTxs.mockReturnValue([tx1, tx2]);

await client.start();
expect(p2pService.propagate).toHaveBeenCalledTimes(2);
expect(p2pService.propagate).toHaveBeenCalledWith(tx1);
expect(p2pService.propagate).toHaveBeenCalledWith(tx2);
});

it('restores the previous block number it was at', async () => {
await client.start();
await client.stop();
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/p2p/src/client/p2p_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,6 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
this.log.debug(`Block ${syncedLatestBlock} (proven ${syncedProvenBlock}) already beyond current block`);
}

// publish any txs in TxPool after its doing initial sync
this.syncPromise = this.syncPromise.then(() => this.publishStoredTxs());

this.blockStream.start();
this.log.verbose(`Started block downloader from block ${syncedLatestBlock}`);

Expand Down

0 comments on commit 39535c9

Please sign in to comment.