Skip to content

Commit 3cf6f70

Browse files
committed
Add in optional flag
1 parent 4d6b3b6 commit 3cf6f70

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

packages/sequencer/src/mempool/private/PrivateMempool.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ type MempoolTransactionPaths = {
3232
transaction: PendingTransaction;
3333
paths: Field[];
3434
};
35+
interface PrivateMempoolConfig {
36+
validationEnabled?: boolean;
37+
}
3538
@sequencerModule()
36-
export class PrivateMempool extends SequencerModule implements Mempool {
39+
export class PrivateMempool
40+
extends SequencerModule<PrivateMempoolConfig>
41+
implements Mempool
42+
{
3743
public readonly events = new EventEmitter<MempoolEvents>();
3844

3945
private readonly accountStateHook: AccountStateHook;
@@ -100,14 +106,16 @@ export class PrivateMempool extends SequencerModule implements Mempool {
100106

101107
const networkState =
102108
(await this.getStagedNetworkState()) ?? NetworkState.empty();
103-
104-
const sortedTxs = await this.checkTxValid(
105-
txs,
106-
baseCachedStateService,
107-
this.protocol.stateServiceProvider,
108-
networkState,
109-
limit
110-
);
109+
const validationEnabled = this.config.validationEnabled ?? true;
110+
const sortedTxs = validationEnabled
111+
? await this.checkTxValid(
112+
txs,
113+
baseCachedStateService,
114+
this.protocol.stateServiceProvider,
115+
networkState,
116+
limit
117+
)
118+
: txs;
111119
this.protocol.stateServiceProvider.popCurrentStateService();
112120
return sortedTxs;
113121
}

0 commit comments

Comments
 (0)