From 47a43cfcf6f8d2f30f8b02d5f8af9ecb913b6eeb Mon Sep 17 00:00:00 2001 From: Dmitry Kuzmenkov Date: Sun, 8 Oct 2017 23:20:03 +0700 Subject: [PATCH 1/2] Fix issue when you need to use multiple inputs but code has code to work with old bitcoinjs-lib package --- modules/findBestMatchByNeededAssets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/findBestMatchByNeededAssets.js b/modules/findBestMatchByNeededAssets.js index 1e84d96..018d29f 100644 --- a/modules/findBestMatchByNeededAssets.js +++ b/modules/findBestMatchByNeededAssets.js @@ -45,7 +45,7 @@ var findBestMatchByNeededAssets = function (utxos, assetList, key, txb, inputval debug('adding input') var inputIndex = txb.tx.ins.length if (!txb.tx.ins.some(function (txutxo, i) { - if (txutxo.index === utxo.index && bitcoinjs.bufferutils.reverse(txutxo.hash).toString('hex') === utxo.txid) { + if (txutxo.index === utxo.index && txutxo.hash.toString('hex').split('').reverse().join('') === utxo.txid) { debug('more assets in same utxo') inputIndex = i return true From 6faaf2789ef5b548fdb2dff1f8bb24c9d2c5eae5 Mon Sep 17 00:00:00 2001 From: Dmitry Kuzmenkov Date: Mon, 9 Oct 2017 00:01:06 +0700 Subject: [PATCH 2/2] Fix wrong address when you pass financeChangeAddress --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ae1ceef..1d496be 100644 --- a/index.js +++ b/index.js @@ -658,7 +658,7 @@ ColoredCoinsBuilder.prototype._addInputsForSendTransaction = function (txb, args if (coloredChange) { coloredOutputIndexes.push(txb.tx.outs.length) } - txb.addOutput(Array.isArray(args.from) ? args.from[0] : args.from, lastOutputValue) + txb.addOutput(changeAddress, lastOutputValue) debug('success') return { txHex: txb.tx.toHex(), metadataSha1: args.torrentHash, multisigOutputs: reedemScripts, coloredOutputIndexes: _.uniqBy(coloredOutputIndexes) } }