New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

coinselect

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coinselect - npm Package Compare versions

Comparing version 3.1.5 to 3.1.7

4

blackjack.js
var utils = require('./utils')
// O(n * n)
// only add inputs if they don't bust the target value (aka, exact match)
// worst-case: O(n)
module.exports = function blackjack (utxos, outputs, feeRate) {

@@ -9,3 +10,2 @@ if (!isFinite(utils.uintOrNaN(feeRate))) return {}

// accumulate inputs until we bust
var inAccum = 0

@@ -12,0 +12,0 @@ var inputs = []

@@ -1,3 +0,4 @@

var accumulative = require('./accum')
var accumulative = require('./accumulative')
var blackjack = require('./blackjack')
var utils = require('./utils')

@@ -32,6 +33,10 @@ // TODO

// order by descending value, minus the inputs approximate fee
function utxoScore (x, feeRate) {
return x.value - (feeRate * utils.inputBytes(x))
}
module.exports = function coinSelect (utxos, outputs, feeRate) {
// order by descending value
utxos = utxos.concat().sort(function (a, b) {
return b.value - a.value
return utxoScore(b, feeRate) - utxoScore(a, feeRate)
})

@@ -38,0 +43,0 @@

{
"name": "coinselect",
"version": "3.1.5",
"version": "3.1.7",
"description": "A transaction input selection module for bitcoin.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -8,4 +8,4 @@ // baseline estimates, used to improve performance

function inputBytes () {
return TX_INPUT_BASE + TX_INPUT_PUBKEYHASH
function inputBytes (input) {
return TX_INPUT_BASE + (input.script ? input.script.length : TX_INPUT_PUBKEYHASH)
}

@@ -19,3 +19,3 @@

/* ... classify the output for input estimate */
return inputBytes() * feeRate
return inputBytes({}) * feeRate
}

@@ -22,0 +22,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc