Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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