Skip to content

Commit

Permalink
Add in optional flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ejMina226 committed Feb 4, 2025
1 parent 4d6b3b6 commit 3cf6f70
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions packages/sequencer/src/mempool/private/PrivateMempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ type MempoolTransactionPaths = {
transaction: PendingTransaction;
paths: Field[];
};
interface PrivateMempoolConfig {
validationEnabled?: boolean;
}
@sequencerModule()
export class PrivateMempool extends SequencerModule implements Mempool {
export class PrivateMempool
extends SequencerModule<PrivateMempoolConfig>
implements Mempool
{
public readonly events = new EventEmitter<MempoolEvents>();

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

const networkState =
(await this.getStagedNetworkState()) ?? NetworkState.empty();

const sortedTxs = await this.checkTxValid(
txs,
baseCachedStateService,
this.protocol.stateServiceProvider,
networkState,
limit
);
const validationEnabled = this.config.validationEnabled ?? true;
const sortedTxs = validationEnabled
? await this.checkTxValid(
txs,
baseCachedStateService,
this.protocol.stateServiceProvider,
networkState,
limit
)
: txs;
this.protocol.stateServiceProvider.popCurrentStateService();
return sortedTxs;
}
Expand Down

0 comments on commit 3cf6f70

Please sign in to comment.