Merge pull request #233 from weilu/pending-spending-utxo
wallet: reintroduce output.to to track pending spent utxo
This commit is contained in:
commit
ab20febbdc
2 changed files with 15 additions and 6 deletions
test
|
@ -215,6 +215,13 @@ describe('Wallet', function() {
|
|||
it('parses wallet outputs to the expect format', function(){
|
||||
assert.deepEqual(wallet.getUnspentOutputs(), [expectedUtxo])
|
||||
})
|
||||
|
||||
it("ignores pending spending outputs (outputs with 'to' property)", function(){
|
||||
var output = wallet.outputs[expectedOutputKey]
|
||||
output.to = fakeTxId(0) + ':' + 0
|
||||
output.pending = true
|
||||
assert.deepEqual(wallet.getUnspentOutputs(), [])
|
||||
})
|
||||
})
|
||||
|
||||
describe('setUnspentOutputs', function(){
|
||||
|
@ -280,7 +287,7 @@ describe('Wallet', function() {
|
|||
spendTx = Transaction.fromHex(fixtureTx2Hex)
|
||||
})
|
||||
|
||||
it("outgoing: sets the pending flag on output instead of deleting it", function(){
|
||||
it("outgoing: sets the pending flag and 'to' on output", function(){
|
||||
var txIn = spendTx.ins[0]
|
||||
var txInId = new Buffer(txIn.hash)
|
||||
Array.prototype.reverse.call(txInId)
|
||||
|
@ -291,6 +298,7 @@ describe('Wallet', function() {
|
|||
|
||||
wallet.processPendingTx(spendTx)
|
||||
assert(wallet.outputs[key].pending)
|
||||
assert.equal(wallet.outputs[key].to, spendTx.getId() + ':' + 0)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue