bsv-coinselect
Advanced tools
Comparing version 4.1.1 to 4.2.1
@@ -15,2 +15,3 @@ var utils = require('./utils') | ||
var outAccum = utils.sumOrNaN(outputs) | ||
// Perform a test to see if transaction can be finalized | ||
@@ -17,0 +18,0 @@ var fee = Math.round(Math.ceil(feeRate * bytesAccum)); |
var accumulative = require('./accumulative') | ||
var blackjack = require('./blackjack') | ||
var utils = require('./utils') | ||
@@ -20,8 +19,4 @@ | ||
// attempt to use the blackjack strategy first (no change output) | ||
var base = blackjack(utxos, outputs, feeRate, changeScript) | ||
if (base.inputs) return base | ||
// else, try the accumulative strategy | ||
return accumulative(utxos, outputs, feeRate, changeScript) | ||
} |
{ | ||
"name": "bsv-coinselect", | ||
"version": "4.1.1", | ||
"version": "4.2.1", | ||
"description": "A transaction input selection module for Bitcoin SV (BSV)", | ||
@@ -29,3 +29,2 @@ "keywords": [ | ||
"accumulative.js", | ||
"blackjack.js", | ||
"index.js", | ||
@@ -32,0 +31,0 @@ "utils.js" |
@@ -139,5 +139,4 @@ # bsv-coinselect | ||
-|-|- | ||
`require('coinselect')` | Blackjack, with Accumulative fallback | By Descending Value | ||
`require('coinselect')` | Accumulative - accumulates inputs until the target value (+fees) is reached, skipping | ||
`require('coinselect/accumulative')` | Accumulative - accumulates inputs until the target value (+fees) is reached, skipping detrimental inputs | - | ||
`require('coinselect/blackjack')` | Blackjack - accumulates inputs until the target value (+fees) is matched, does not accumulate inputs that go over the target value (within a threshold) | - | ||
@@ -144,0 +143,0 @@ **Note:** Each algorithm will add a change output if the `input - output - fee` value difference is over a dust threshold. |
@@ -82,3 +82,2 @@ // baseline estimates, used to improve performance | ||
if (remainderAfterExtraOutput > dustThreshold({}, feeRate)) { | ||
if (changeScript || changeScript === null) { | ||
@@ -85,0 +84,0 @@ outputs = outputs.concat({ |
14143
6
160
196