diff --git a/yarn-project/p2p/src/services/libp2p/libp2p_service.ts b/yarn-project/p2p/src/services/libp2p/libp2p_service.ts index a553fb4a4aad..378cfd7f78c7 100644 --- a/yarn-project/p2p/src/services/libp2p/libp2p_service.ts +++ b/yarn-project/p2p/src/services/libp2p/libp2p_service.ts @@ -497,18 +497,12 @@ export class LibP2PService extends WithTracer implement }); } - private async processTxFromPeer(tx: Tx, peerId: PeerId): Promise { + private async processTxFromPeer(tx: Tx, _peerId: PeerId): Promise { const txHash = tx.getTxHash(); const txHashString = txHash.toString(); this.logger.verbose(`Received tx ${txHashString} from external peer.`); - const timer = new Timer(); - const isValidTx = await this.validatePropagatedTx(tx, peerId); - this.logger.info(`\n\n\n validatePropagatedTx took ${timer.ms()}ms \n\n\n`); - if (isValidTx) { - await this.mempools.txPool.addTxs([tx]); - } } /** @@ -550,7 +544,13 @@ export class LibP2PService extends WithTracer implement private async validatePropagatedTxFromMessage(propagationSource: PeerId, msg: Message): Promise { const tx = Tx.fromBuffer(Buffer.from(msg.data)); + const timer = new Timer(); const isValid = await this.validatePropagatedTx(tx, propagationSource); + this.logger.info(`\n\n\n validatePropagatedTx took ${timer.ms()}ms \n\n\n`); + this.logger.trace(`validatePropagatedTx: ${isValid}`, { + [Attributes.TX_HASH]: tx.getTxHash().toString(), + [Attributes.P2P_ID]: propagationSource.toString(), + }); return isValid ? TopicValidatorResult.Accept : TopicValidatorResult.Reject; } @@ -625,7 +625,9 @@ export class LibP2PService extends WithTracer implement messageValidators: Record ): Promise { const validationPromises = Object.entries(messageValidators).map(async ([name, { validator, severity }]) => { + const timer = new Timer(); const isValid = await validator.validateTx(tx); + this.logger.info(`\n\n\n VALIDATOR: ${name} took ${timer.ms()}ms \n\n\n`); return { name, isValid, severity }; });