diff --git a/elements/lisk-transaction-pool/src/types.ts b/elements/lisk-transaction-pool/src/types.ts index baa7f2fd277..167e236c3b9 100644 --- a/elements/lisk-transaction-pool/src/types.ts +++ b/elements/lisk-transaction-pool/src/types.ts @@ -26,7 +26,7 @@ export interface TransactionObject { signatures?: ReadonlyArray; readonly type: number; verifiedOnce?: boolean; - feePriority: bigint; + feePriority?: bigint; } export interface TransactionFunctions { diff --git a/framework/src/application/node/forger/forger.ts b/framework/src/application/node/forger/forger.ts index b2030ecb065..c6f60118975 100644 --- a/framework/src/application/node/forger/forger.ts +++ b/framework/src/application/node/forger/forger.ts @@ -207,7 +207,8 @@ export class Forger { keypair.publicKey.toString('hex'), ]); - if (account.isDelegate) { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (account?.isDelegate) { if (forging) { this.keypairs[ getAddressFromPublicKey(keypair.publicKey.toString('hex')) diff --git a/framework/src/application/node/forger/strategies.ts b/framework/src/application/node/forger/strategies.ts index 47dcfc9d012..219e07d9229 100644 --- a/framework/src/application/node/forger/strategies.ts +++ b/framework/src/application/node/forger/strategies.ts @@ -13,14 +13,17 @@ */ import { MaxHeap, TransactionPool } from '@liskhq/lisk-transaction-pool'; -import { Status as TransactionStatus, BaseTransaction } from '@liskhq/lisk-transactions'; +import { + Status as TransactionStatus, + BaseTransaction, +} from '@liskhq/lisk-transactions'; import { Chain } from '@liskhq/lisk-chain'; export class HighFeeForgingStrategy { private readonly chainModule: Chain; private readonly transactionPoolModule: TransactionPool; private readonly constants: { - readonly maxPayloadLength: number + readonly maxPayloadLength: number; }; public constructor({ @@ -30,9 +33,9 @@ export class HighFeeForgingStrategy { // constants maxPayloadLength, }: { - readonly chainModule: Chain, - readonly transactionPoolModule: TransactionPool, - readonly maxPayloadLength: number + readonly chainModule: Chain; + readonly transactionPoolModule: TransactionPool; + readonly maxPayloadLength: number; }) { this.chainModule = chainModule; this.transactionPoolModule = transactionPoolModule; @@ -55,13 +58,17 @@ export class HighFeeForgingStrategy { const feePriorityHeap = new MaxHeap(); for (const senderId of Object.keys(transactionsBySender)) { const lowestNonceTrx = transactionsBySender[senderId][0]; - feePriorityHeap.push(lowestNonceTrx.feePriority, lowestNonceTrx); + feePriorityHeap.push( + lowestNonceTrx.feePriority as bigint, + lowestNonceTrx, + ); } // Loop till we have last account exhausted to pick transactions while (Object.keys(transactionsBySender).length !== 0) { // Get the transaction with highest fee and lowest nonce - const lowestNonceHighestFeeTrx = (feePriorityHeap.pop()?.value) as BaseTransaction; + const lowestNonceHighestFeeTrx = feePriorityHeap.pop() + ?.value as BaseTransaction; // Try to process transaction const result = await this.chainModule.applyTransactionsWithStateStore( [lowestNonceHighestFeeTrx], @@ -115,7 +122,7 @@ export class HighFeeForgingStrategy { const nextLowestNonceTransaction = transactionsBySender[lowestNonceHighestFeeTrx.senderId][0]; feePriorityHeap.push( - nextLowestNonceTransaction.feePriority, + nextLowestNonceTransaction.feePriority as bigint, nextLowestNonceTransaction, ); }