Skip to content

Commit a0ae40a

Browse files
authored
Merge pull request #5 from bitcoinerlab/fix/utxo-zero-value-validation
Fix: Allow UTXO with value zero in validation
2 parents b568bf8 + fac662f commit a0ae40a

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

package-lock.json

Lines changed: 14 additions & 14 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.2.0",
3+
"version": "1.2.1",
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/validation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export function validateOutputWithValues(
77
if (outputAndValues.length === 0) throw new Error('Empty group');
88
for (const outputAndValue of outputAndValues) {
99
const value = outputAndValue.value;
10-
if (!Number.isInteger(value) || value <= 0 || value > 1e14 /*1 M Btc*/) {
10+
//note an utxo with value === 0 is possible, see https://blockstream.info/testnet/tx/a063dbdc23cf969df020536f75c431167a2bbf29d6215a2067495ac46991c954
11+
if (!Number.isInteger(value) || value < 0 || value > 1e14 /*1 M Btc*/) {
1112
throw new Error(`Input value ${value} not supported`);
1213
}
1314
}

0 commit comments

Comments
 (0)