Merge pull request #562 from matiu/feature/txbuilder-utxos

serialize only the list of selected utxos, if available
This commit is contained in:
Manuel Aráoz 2014-11-21 10:18:04 -03:00
commit 3e43d79b6e

View File

@ -821,10 +821,12 @@ TransactionBuilder.prototype.build = function() {
// //
TransactionBuilder.prototype.toObj = function() { TransactionBuilder.prototype.toObj = function() {
var utxos = this.selectedUtxos && this.selectedUtxos[0] ? this.selectedUtxos : JSON.parse(this.vanilla.utxos);
var ret = { var ret = {
version: TOOBJ_VERSION, version: TOOBJ_VERSION,
outs: JSON.parse(this.vanilla.outs), outs: JSON.parse(this.vanilla.outs),
utxos: JSON.parse(this.vanilla.utxos), utxos: utxos,
opts: JSON.parse(this.vanilla.opts), opts: JSON.parse(this.vanilla.opts),
scriptSig: this.vanilla.scriptSig, scriptSig: this.vanilla.scriptSig,
}; };