Skip to content

Commit

Permalink
Merge pull request #168 from bitcoin-sv/fix/off-by-one-error
Browse files Browse the repository at this point in the history
[ FIX ] off by one sats check when adding an output.
  • Loading branch information
sirdeggen authored Dec 29, 2024
2 parents 8bfc6eb + bd8e49d commit d467141
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bsv/sdk",
"version": "1.2.19",
"version": "1.2.20",
"type": "module",
"description": "BSV Blockchain Software Development Kit",
"main": "dist/cjs/mod.js",
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export default class Transaction {
this.cachedHash = undefined
if (!output.change) {
if (typeof output.satoshis === 'undefined') throw new Error('either satoshis must be defined or change must be set to true')
if (output.satoshis <= 0) throw new Error('satoshis must be a positive integer or zero')
if (output.satoshis < 0) throw new Error('satoshis must be a positive integer or zero')
}
if (!output.lockingScript) throw new Error('lockingScript must be defined')
this.outputs.push(output)
Expand Down

0 comments on commit d467141

Please sign in to comment.