Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1167 from LiskHQ/1166-return_queue_name_with_add_…
Browse files Browse the repository at this point in the history
…transaction_result

When adding transaction, the transaction pool should return the name of the queue along with the status - Closes #1166
  • Loading branch information
shuse2 authored Mar 6, 2019
2 parents 0845f16 + f98760f commit 0368b94
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/lisk-transaction-pool/src/transaction_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export interface TransactionPoolConfiguration {
export interface AddTransactionResult {
readonly alreadyExists: boolean;
readonly isFull: boolean;
readonly queueName: QueueNames;
}

interface TransactionPoolDependencies {
Expand Down Expand Up @@ -426,13 +427,15 @@ export class TransactionPool extends EventEmitter {
return {
isFull: false,
alreadyExists: true,
queueName,
};
}

if (this._queues[queueName].size() >= this._maxTransactionsPerQueue) {
return {
isFull: true,
alreadyExists: false,
queueName,
};
}
// Add receivedAt property for the transaction
Expand All @@ -449,6 +452,7 @@ export class TransactionPool extends EventEmitter {
return {
isFull: false,
alreadyExists: false,
queueName,
};
}

Expand Down

0 comments on commit 0368b94

Please sign in to comment.