isCoinbase. cleanup. add txid, vout, scriptSig to coinbase inputs.

This commit is contained in:
Christopher Jeffrey 2014-09-25 14:19:46 -07:00
parent 219a513771
commit 447fec3874
1 changed files with 10 additions and 4 deletions

View File

@ -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);