diff --git a/Transaction.js b/Transaction.js index 3393f3698..fb7a8f764 100644 --- a/Transaction.js +++ b/Transaction.js @@ -16,7 +16,7 @@ var WalletKey = imports.WalletKey || require('./WalletKey'); var PrivateKey = imports.PrivateKey || require('./PrivateKey'); var COINBASE_OP = Buffer.concat([util.NULL_HASH, new Buffer('FFFFFFFF', 'hex')]); -var DEFAULT_FEE = 0.0001; +var DEFAULT_FEE = 0.001; function TransactionIn(data) { if ("object" !== typeof data) { @@ -690,20 +690,7 @@ Transaction.prototype.parse = function (parser) { * * Selects some unspent outputs for later usage in tx inputs * - * @unspentArray: unspent array (UTXO) avaible on the form: - * [{ - * address: "mqSjTad2TKbPcKQ3Jq4kgCkKatyN44UMgZ", - * hash: "2ac165fa7a3a2b535d106a0041c7568d03b531e58aeccdd3199d7289ab12cfc1", - * scriptPubKey: "76a9146ce4e1163eb18939b1440c42844d5f0261c0338288ac", - * vout: 1, - * amount: 0.01, - * confirmations: 3 - * }, [...] - * ] - * This is compatible con insight's utxo API. - * That amount is in BTCs (as returned in insight and bitcoind). - * amountSat (instead of amount) can be given to provide amount in satochis. - * + * @utxos * @totalNeededAmount: output transaction amount in BTC, including fee * @allowUnconfirmed: false (allow selecting unconfirmed utxos) * @@ -715,13 +702,13 @@ Transaction.prototype.parse = function (parser) { * */ -Transaction.selectUnspent = function (unspentArray, totalNeededAmount, allowUnconfirmed) { +Transaction.selectUnspent = function (utxos, totalNeededAmount, allowUnconfirmed) { var minConfirmationSteps = [6,1]; if (allowUnconfirmed) minConfirmationSteps.push(0); var ret = []; - var l = unspentArray.length; + var l = utxos.length; var totalSat = bignum(0); var totalNeededAmountSat = util.parseValue(totalNeededAmount); var fulfill = false; @@ -730,7 +717,7 @@ Transaction.selectUnspent = function (unspentArray, totalNeededAmount, allowUnco do { var minConfirmations = minConfirmationSteps.shift(); for(var i = 0; i