Changes sequence number to an actual Number
This commit is contained in:
parent
752aeae0d3
commit
09c6a787d9
2 changed files with 5 additions and 5 deletions
|
@ -16,7 +16,7 @@ var Transaction = function (doc) {
|
||||||
this.locktime = 0
|
this.locktime = 0
|
||||||
this.ins = []
|
this.ins = []
|
||||||
this.outs = []
|
this.outs = []
|
||||||
this.defaultSequence = [255, 255, 255, 255] // 0xFFFFFFFF
|
this.defaultSequence = 0xffffffff
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
if (typeof doc == "string" || Array.isArray(doc)) {
|
if (typeof doc == "string" || Array.isArray(doc)) {
|
||||||
|
@ -137,7 +137,7 @@ Transaction.prototype.serialize = function () {
|
||||||
var scriptBytes = txin.script.buffer
|
var scriptBytes = txin.script.buffer
|
||||||
buffer = buffer.concat(convert.numToVarInt(scriptBytes.length))
|
buffer = buffer.concat(convert.numToVarInt(scriptBytes.length))
|
||||||
buffer = buffer.concat(scriptBytes)
|
buffer = buffer.concat(scriptBytes)
|
||||||
buffer = buffer.concat(txin.sequence)
|
buffer = buffer.concat(convert.numToBytes(txin.sequence, 4))
|
||||||
})
|
})
|
||||||
|
|
||||||
buffer = buffer.concat(convert.numToVarInt(this.outs.length))
|
buffer = buffer.concat(convert.numToVarInt(this.outs.length))
|
||||||
|
@ -289,7 +289,7 @@ Transaction.deserialize = function(buffer) {
|
||||||
index: readAsInt(4)
|
index: readAsInt(4)
|
||||||
},
|
},
|
||||||
script: new Script(readVarString()),
|
script: new Script(readVarString()),
|
||||||
sequence: readBytes(4)
|
sequence: readAsInt(4)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
var outs = readVarInt()
|
var outs = readVarInt()
|
||||||
|
|
|
@ -50,7 +50,7 @@ describe('Transaction', function() {
|
||||||
assert.equal(tx.ins.length, 1)
|
assert.equal(tx.ins.length, 1)
|
||||||
|
|
||||||
var input = tx.ins[0]
|
var input = tx.ins[0]
|
||||||
assert.deepEqual(input.sequence, [255, 255, 255, 255])
|
assert.equal(input.sequence, 4294967295)
|
||||||
|
|
||||||
assert.equal(input.outpoint.index, 0)
|
assert.equal(input.outpoint.index, 0)
|
||||||
assert.equal(input.outpoint.hash, "69d02fc05c4e0ddc87e796eee42693c244a3112fffe1f762c3fb61ffcb304634")
|
assert.equal(input.outpoint.hash, "69d02fc05c4e0ddc87e796eee42693c244a3112fffe1f762c3fb61ffcb304634")
|
||||||
|
@ -128,7 +128,7 @@ describe('Transaction', function() {
|
||||||
assert.equal(tx.ins.length, 1)
|
assert.equal(tx.ins.length, 1)
|
||||||
|
|
||||||
var input = tx.ins[0]
|
var input = tx.ins[0]
|
||||||
assert.deepEqual(input.sequence, [255, 255, 255, 255])
|
assert.equal(input.sequence, 4294967295)
|
||||||
|
|
||||||
assert.equal(input.outpoint.index, 0)
|
assert.equal(input.outpoint.index, 0)
|
||||||
assert.equal(input.outpoint.hash, "0cb859105100ebc3344f749c835c7af7d7103ec0d8cbc3d8ccbd5d28c3c36b57")
|
assert.equal(input.outpoint.hash, "0cb859105100ebc3344f749c835c7af7d7103ec0d8cbc3d8ccbd5d28c3c36b57")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue