Skip to content

Commit

Permalink
chore: fix typo in transaction fee errors (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
dated authored Mar 8, 2024
1 parent b4d5ff7 commit 79eafc0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions packages/contracts/source/exceptions/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export class TransactionHasExpiredError extends PoolError {
}
}

export class TransactionFeeToLowError extends PoolError {
export class TransactionFeeTooLowError extends PoolError {
public constructor(transaction: Transaction) {
super(`tx ${transaction.id} fee is to low to enter the pool`, "ERR_LOW_FEE");
super(`tx ${transaction.id} fee is too low to enter the pool`, "ERR_LOW_FEE");
}
}

export class TransactionFeeToHighError extends PoolError {
export class TransactionFeeTooHighError extends PoolError {
public constructor(transaction: Transaction) {
super(`tx ${transaction.id} fee is to high to enter the pool`, "ERR_HIGH_FEE");
super(`tx ${transaction.id} fee is too high to enter the pool`, "ERR_HIGH_FEE");
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/fees-managed/source/matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class FeeMatcher implements Contracts.TransactionPool.FeeMatcher {

this.logger.notice(`Tx ${transaction} not eligible for ${action} (fee ${feeString} < ${minFeeString})`);

throw new Exceptions.TransactionFeeToLowError(transaction);
throw new Exceptions.TransactionFeeTooLowError(transaction);
}

#calculateMinFee(transaction: Contracts.Crypto.Transaction): BigNumber {
Expand Down
4 changes: 2 additions & 2 deletions packages/fees-static/source/matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export class FeeMatcher implements Contracts.TransactionPool.FeeMatcher {
if (transaction.data.fee.isLessThan(staticFee)) {
this.logger.notice(`${transaction.id} not eligible for ${action} (fee ${feeString} < ${staticFeeString})`);

throw new Exceptions.TransactionFeeToLowError(transaction);
throw new Exceptions.TransactionFeeTooLowError(transaction);
}

this.logger.notice(`${transaction.id} not eligible for ${action} (fee ${feeString} > ${staticFeeString})`);

throw new Exceptions.TransactionFeeToHighError(transaction);
throw new Exceptions.TransactionFeeTooHighError(transaction);
}

#formatSatoshi(amount: BigNumber): string {
Expand Down
6 changes: 3 additions & 3 deletions packages/transaction-pool/source/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ describe<{
assert.equal(error.message, `tx ${context.transaction.id} expired at height 100`);
});

it("TransactionFeeToLowError", (context) => {
const error = new Exceptions.TransactionFeeToLowError(context.transaction);
it("TransactionFeeTooLowError", (context) => {
const error = new Exceptions.TransactionFeeTooLowError(context.transaction);

assert.instance(error, Exceptions.PoolError);
assert.equal(error.type, "ERR_LOW_FEE");
assert.equal(error.message, `tx ${context.transaction.id} fee is to low to enter the pool`);
assert.equal(error.message, `tx ${context.transaction.id} fee is too low to enter the pool`);
});

it("SenderExceededMaximumTransactionCountError", (context) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/transaction-pool/source/processor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ describe<{

spiedExtension0
.callsFakeNth(0, async (transaction) => {
throw new Exceptions.TransactionFeeToLowError(transaction);
throw new Exceptions.TransactionFeeTooLowError(transaction);
})
.callsFakeNth(1, async (transaction) => {
throw new Exceptions.TransactionFeeToLowError(transaction);
throw new Exceptions.TransactionFeeTooLowError(transaction);
});

const spiedExtension1 = spy(context.extensions[1], "throwIfCannotBroadcast");
Expand All @@ -130,7 +130,7 @@ describe<{
poolStub
.callsFakeNth(0, async (transaction) => {})
.callsFakeNth(1, async (transaction) => {
throw new Exceptions.TransactionFeeToLowError(transaction);
throw new Exceptions.TransactionFeeTooLowError(transaction);
});

const spiedExtension0 = spy(context.extensions[0], "throwIfCannotBroadcast");
Expand Down Expand Up @@ -162,7 +162,7 @@ describe<{
spiedExtension0
.callsFakeNth(0, async (transaction) => {})
.callsFakeNth(1, async (transaction) => {
throw new Exceptions.TransactionFeeToLowError(transaction);
throw new Exceptions.TransactionFeeTooLowError(transaction);
});

const spiedExtension1 = spy(context.extensions[1], "throwIfCannotBroadcast");
Expand Down

0 comments on commit 79eafc0

Please sign in to comment.