Skip to content

Commit 8f32392

Browse files
authored
Merge pull request #13 from bitcoinerlab/new-min-fee-rate
Support fractional minimum fee rate (0.1 sat/vB)
2 parents 2e6a050 + e6e0dd2 commit 8f32392

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitcoinerlab/coinselect",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"author": "Jose-Luis Landabaso",
55
"license": "MIT",
66
"description": "A TypeScript library for Bitcoin transaction management, based on Bitcoin Descriptors for defining inputs and outputs. It facilitates optimal UTXO selection and transaction size calculation.",

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
export const DUST_RELAY_FEE_RATE = 3;
66
//10 times larger than 2017 peak
77
export const MAX_FEE_RATE = 10000;
8+
export const MIN_FEE_RATE = 0.1;
89

910
import type { OutputInstance } from '@bitcoinerlab/descriptors';
1011

src/validation.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { OutputWithValue, MAX_FEE_RATE, DUST_RELAY_FEE_RATE } from './index';
1+
import {
2+
OutputWithValue,
3+
MIN_FEE_RATE,
4+
MAX_FEE_RATE,
5+
DUST_RELAY_FEE_RATE
6+
} from './index';
27
import { vsize } from './vsize';
38
import { isDust } from './dust';
49
export function validateOutputWithValues(
@@ -14,7 +19,11 @@ export function validateOutputWithValues(
1419
}
1520
}
1621
export function validateFeeRate(feeRate: number) {
17-
if (!Number.isFinite(feeRate) || feeRate < 1 || feeRate > MAX_FEE_RATE) {
22+
if (
23+
!Number.isFinite(feeRate) ||
24+
feeRate < MIN_FEE_RATE ||
25+
feeRate > MAX_FEE_RATE
26+
) {
1827
throw new Error(`Fee rate ${feeRate} not supported`);
1928
}
2029
}

0 commit comments

Comments
 (0)