wallet: rename utxo.receive to utxo.from

This commit is contained in:
Wei Lu 2014-06-18 14:34:53 +08:00
parent 7e98123ccd
commit 7e31668b69
2 changed files with 7 additions and 7 deletions

View file

@ -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

View file

@ -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)