diff --git a/src/wallet.js b/src/wallet.js index 48b9d8d..78be584 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -77,14 +77,14 @@ function Wallet(seed, network) { utxo.forEach(function(uo){ validateUnspentOutput(uo) var o = unspentOutputToOutput(uo) - outputs[o.receive] = o + outputs[o.from] = o }) this.outputs = outputs } function outputToUnspentOutput(output){ - var hashAndIndex = output.receive.split(":") + var hashAndIndex = output.from.split(":") return { hash: hashAndIndex[0], @@ -99,7 +99,7 @@ function Wallet(seed, network) { var hash = o.hash var key = hash + ":" + o.outputIndex return { - receive: key, + from: key, address: o.address, value: o.value, pending: o.pending @@ -159,7 +159,7 @@ function Wallet(seed, network) { var output = txid + ':' + i me.outputs[output] = { - receive: output, + from: output, value: txOut.value, address: address, pending: isPending @@ -194,7 +194,7 @@ function Wallet(seed, network) { var utxo = utxos[i] addresses.push(utxo.address) - var outpoint = utxo.receive.split(':') + var outpoint = utxo.from.split(':') tx.addInput(outpoint[0], parseInt(outpoint[1])) var fee = fixedFee == undefined ? estimateFeePadChangeOutput(tx) : fixedFee diff --git a/test/wallet.js b/test/wallet.js index 356c590..a1f0905 100644 --- a/test/wallet.js +++ b/test/wallet.js @@ -184,7 +184,7 @@ describe('Wallet', function() { function addUtxoToOutput(utxo){ var key = utxo.hash + ":" + utxo.outputIndex wallet.outputs[key] = { - receive: key, + from: key, address: utxo.address, value: utxo.value, pending: utxo.pending @@ -352,7 +352,7 @@ describe('Wallet', function() { var txOut = tx.outs[index] var key = tx.getId() + ":" + index var output = wallet.outputs[key] - assert.equal(output.receive, key) + assert.equal(output.from, key) assert.equal(output.value, txOut.value) assert.equal(output.pending, pending)