isCoinbase. cleanup. add txid, vout, scriptSig to coinbase inputs.
This commit is contained in:
parent
219a513771
commit
447fec3874
|
@ -342,6 +342,15 @@ function Transaction(data) {
|
|||
}
|
||||
});
|
||||
|
||||
if (this.isCoinbase()) {
|
||||
this.vin[0].txid = Array(64 + 1).join('0');
|
||||
this.vin[0].vout = 0;
|
||||
this.vin[0].scriptSig = {
|
||||
asm: null,
|
||||
hex: this.vin[0].coinbase
|
||||
};
|
||||
}
|
||||
|
||||
this.toHex();
|
||||
}
|
||||
|
||||
|
@ -378,7 +387,7 @@ Transaction.prototype.computePriority = function() {
|
|||
};
|
||||
|
||||
Transaction.prototype.isCoinbase = function() {
|
||||
;
|
||||
return this.vin.length === 1 && this.vin[0].coinbase;
|
||||
};
|
||||
|
||||
Transaction.prototype.equal = function() {
|
||||
|
@ -422,9 +431,6 @@ Transaction.toBinary = function(tx) {
|
|||
off += utils.copy(s, p, off, true);
|
||||
|
||||
off += utils.writeU32(p, input.sequence, off);
|
||||
|
||||
// off += utils.copy(new bn(input.coinbase, 'hex').toArray(), p, off, true);
|
||||
// off += utils.writeU32(p, input.sequence, off);
|
||||
} else {
|
||||
off += utils.copy(new bn(input.txid, 'hex').toArray(), p, off, true);
|
||||
off += utils.writeU32(p, input.vout, off);
|
||||
|
|
Loading…
Reference in New Issue