Transaction: remove .outpoint object
This commit is contained in:
parent
569e0d4ff1
commit
c0e5393595
5 changed files with 31 additions and 32 deletions
|
@ -147,7 +147,7 @@ describe('Bitcoin-core', function() {
|
|||
var prevOutIndex = input[1]
|
||||
// var prevOutScriptPubKey = input[2] // TODO: we don't have a ASM parser
|
||||
|
||||
var actualHash = txin.outpoint.hash
|
||||
var actualHash = txin.hash
|
||||
|
||||
// Test data is big-endian
|
||||
Array.prototype.reverse.call(actualHash)
|
||||
|
@ -155,7 +155,7 @@ describe('Bitcoin-core', function() {
|
|||
assert.equal(actualHash.toString('hex'), prevOutHash)
|
||||
|
||||
// we read UInt32, not Int32
|
||||
assert.equal(txin.outpoint.index & 0xffffffff, prevOutIndex)
|
||||
assert.equal(txin.index & 0xffffffff, prevOutIndex)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -51,8 +51,8 @@ describe('Transaction', function() {
|
|||
var input = tx.ins[0]
|
||||
assert.equal(input.sequence, 4294967295)
|
||||
|
||||
assert.equal(input.outpoint.index, 0)
|
||||
assert.equal(input.outpoint.hash.toString('hex'), "344630cbff61fbc362f7e1ff2f11a344c29326e4ee96e787dc0d4e5cc02fd069")
|
||||
assert.equal(input.index, 0)
|
||||
assert.equal(input.hash.toString('hex'), "344630cbff61fbc362f7e1ff2f11a344c29326e4ee96e787dc0d4e5cc02fd069")
|
||||
|
||||
assert.equal(input.script.toHex(), "493046022100ef89701f460e8660c80808a162bbf2d676f40a331a243592c36d6bd1f81d6bdf022100d29c072f1b18e59caba6e1f0b8cadeb373fd33a25feded746832ec179880c23901")
|
||||
})
|
||||
|
@ -118,8 +118,8 @@ describe('Transaction', function() {
|
|||
var input = tx.ins[0]
|
||||
assert.equal(input.sequence, 4294967295)
|
||||
|
||||
assert.equal(input.outpoint.index, 0)
|
||||
assert.equal(input.outpoint.hash.toString('hex'), "576bc3c3285dbdccd8c3cbd8c03e10d7f77a5c839c744f34c3eb00511059b80c")
|
||||
assert.equal(input.index, 0)
|
||||
assert.equal(input.hash.toString('hex'), "576bc3c3285dbdccd8c3cbd8c03e10d7f77a5c839c744f34c3eb00511059b80c")
|
||||
|
||||
assert.equal(input.script, Script.EMPTY)
|
||||
}
|
||||
|
|
|
@ -328,11 +328,11 @@ describe('Wallet', function() {
|
|||
|
||||
it("deletes corresponding 'output'", function(){
|
||||
var txIn = spendTx.ins[0]
|
||||
var txInId = new Buffer(txIn.outpoint.hash)
|
||||
var txInId = new Buffer(txIn.hash)
|
||||
Array.prototype.reverse.call(txInId)
|
||||
txInId = txInId.toString('hex')
|
||||
|
||||
var expected = txInId + ':' + txIn.outpoint.index
|
||||
var expected = txInId + ':' + txIn.index
|
||||
assert(expected in wallet.outputs)
|
||||
|
||||
wallet.processConfirmedTx(spendTx)
|
||||
|
@ -400,7 +400,8 @@ describe('Wallet', function() {
|
|||
var tx = wallet.createTx(to, value)
|
||||
|
||||
assert.equal(tx.ins.length, 1)
|
||||
assert.deepEqual(tx.ins[0].outpoint, { hash: fakeTxHash(3), index: 0 })
|
||||
assert.deepEqual(tx.ins[0].hash, fakeTxHash(3))
|
||||
assert.equal(tx.ins[0].index, 0)
|
||||
})
|
||||
|
||||
it('allows fee to be specified', function(){
|
||||
|
@ -408,8 +409,11 @@ describe('Wallet', function() {
|
|||
var tx = wallet.createTx(to, value, fee)
|
||||
|
||||
assert.equal(tx.ins.length, 2)
|
||||
assert.deepEqual(tx.ins[0].outpoint, { hash: fakeTxHash(3), index: 0 })
|
||||
assert.deepEqual(tx.ins[1].outpoint, { hash: fakeTxHash(2), index: 1 })
|
||||
|
||||
assert.deepEqual(tx.ins[0].hash, fakeTxHash(3))
|
||||
assert.equal(tx.ins[0].index, 0)
|
||||
assert.deepEqual(tx.ins[1].hash, fakeTxHash(2))
|
||||
assert.equal(tx.ins[1].index, 1)
|
||||
})
|
||||
|
||||
it('allows fee to be set to zero', function(){
|
||||
|
@ -418,7 +422,8 @@ describe('Wallet', function() {
|
|||
var tx = wallet.createTx(to, value, fee)
|
||||
|
||||
assert.equal(tx.ins.length, 1)
|
||||
assert.deepEqual(tx.ins[0].outpoint, { hash: fakeTxHash(3), index: 0 })
|
||||
assert.deepEqual(tx.ins[0].hash, fakeTxHash(3))
|
||||
assert.equal(tx.ins[0].index, 0)
|
||||
})
|
||||
|
||||
it('ignores pending outputs', function(){
|
||||
|
@ -436,7 +441,8 @@ describe('Wallet', function() {
|
|||
var tx = wallet.createTx(to, value)
|
||||
|
||||
assert.equal(tx.ins.length, 1)
|
||||
assert.deepEqual(tx.ins[0].outpoint, { hash: fakeTxHash(3), index: 0 })
|
||||
assert.deepEqual(tx.ins[0].hash, fakeTxHash(3))
|
||||
assert.equal(tx.ins[0].index, 0)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue