Transaction: fix coinbase script handling
This commit is contained in:
parent
445eb260c0
commit
23bae5748e
1 changed files with 22 additions and 6 deletions
|
@ -51,17 +51,33 @@ Transaction.fromBuffer = function(buffer, __disableAssert) {
|
||||||
return Script.fromBuffer(readSlice(readVarInt()))
|
return Script.fromBuffer(readSlice(readVarInt()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readGenerationScript() {
|
||||||
|
return new Script(readSlice(readVarInt()), [])
|
||||||
|
}
|
||||||
|
|
||||||
var tx = new Transaction()
|
var tx = new Transaction()
|
||||||
tx.version = readUInt32()
|
tx.version = readUInt32()
|
||||||
|
|
||||||
var vinLen = readVarInt()
|
var vinLen = readVarInt()
|
||||||
for (var i = 0; i < vinLen; ++i) {
|
for (var i = 0; i < vinLen; ++i) {
|
||||||
tx.ins.push({
|
var hash = readSlice(32)
|
||||||
hash: readSlice(32),
|
|
||||||
index: readUInt32(),
|
if (Transaction.isCoinbaseHash(hash)) {
|
||||||
script: readScript(),
|
tx.ins.push({
|
||||||
sequence: readUInt32()
|
hash: hash,
|
||||||
})
|
index: readUInt32(),
|
||||||
|
script: readGenerationScript(),
|
||||||
|
sequence: readUInt32()
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
tx.ins.push({
|
||||||
|
hash: hash,
|
||||||
|
index: readUInt32(),
|
||||||
|
script: readScript(),
|
||||||
|
sequence: readUInt32()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var voutLen = readVarInt()
|
var voutLen = readVarInt()
|
||||||
|
|
Loading…
Reference in a new issue