From f53050445afe8568a3a97561ddc7fe09d3dcaa73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Piwo=C5=84ski?= Date: Fri, 29 Sep 2023 14:18:37 +0200 Subject: [PATCH] Fix nonce in spam command --- core/src/lib/scripts/spam.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/src/lib/scripts/spam.ts b/core/src/lib/scripts/spam.ts index 7ba65fc..13c175c 100644 --- a/core/src/lib/scripts/spam.ts +++ b/core/src/lib/scripts/spam.ts @@ -19,7 +19,6 @@ export const spam = async ( wallet: Wallet, params: { targetBlockNumber: number, - virtualNonce: number, txsPerBundle: number, sendRoute: SendRoute, txStrategy?: TxStrategy, @@ -36,9 +35,8 @@ export const spam = async ( .map((_, idx) => mevFlood.generateSwaps( swapParams, [wallet], - params.virtualNonce + idx + idx ))) - params.virtualNonce = params.virtualNonce + txBundles.map(b => b.swaps.signedSwaps.length).reduce((a, b) => a + b, 0) const bundle = txBundles.map(txb => txb.swaps.signedSwaps.map(s => s.signedTx)).flat() if (params.sendRoute === SendRoute.Mempool) { @@ -65,9 +63,8 @@ export const spamLoop = async (mevFlood: MevFlood, wallet: Wallet, params: { } let lastBlockSampledAt = now() let targetBlockNumber = await wallet.provider.getBlockNumber() + 1 - let virtualNonce = await wallet.getTransactionCount() while (true) { - spam(mevFlood, wallet, {targetBlockNumber, virtualNonce, txsPerBundle: 1, sendRoute: params.sendRoute, txStrategy: params.txStrategy}) + spam(mevFlood, wallet, {targetBlockNumber, txsPerBundle: 1, sendRoute: params.sendRoute, txStrategy: params.txStrategy}) await sleep(params.secondsPerBundle * 1000) if (now() - lastBlockSampledAt > 12000) { targetBlockNumber += 1