coinview: fix parsing.
This commit is contained in:
parent
e754621dd4
commit
5e23b284a3
@ -421,7 +421,7 @@ CoinView.prototype.fromFast = function fromFast(br, tx) {
|
|||||||
|
|
||||||
for (i = 0; i < tx.inputs.length; i++) {
|
for (i = 0; i < tx.inputs.length; i++) {
|
||||||
input = tx.inputs[i];
|
input = tx.inputs[i];
|
||||||
prevout = input.prevout.hash;
|
prevout = input.prevout;
|
||||||
|
|
||||||
if (br.readU8() === 0)
|
if (br.readU8() === 0)
|
||||||
continue;
|
continue;
|
||||||
@ -442,6 +442,18 @@ CoinView.prototype.fromFast = function fromFast(br, tx) {
|
|||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read serialized view data from a buffer
|
||||||
|
* reader as it pertains to a transaction.
|
||||||
|
* @param {BufferReader} br
|
||||||
|
* @param {TX} tx
|
||||||
|
* @returns {CoinView}
|
||||||
|
*/
|
||||||
|
|
||||||
|
CoinView.fromFast = function fromFast(br, tx) {
|
||||||
|
return new CoinView().fromFast(br, tx);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write coin data to buffer writer
|
* Write coin data to buffer writer
|
||||||
* as it pertains to a transaction.
|
* as it pertains to a transaction.
|
||||||
@ -511,7 +523,7 @@ CoinView.prototype.fromReader = function fromReader(br, tx) {
|
|||||||
|
|
||||||
for (i = 0; i < tx.inputs.length; i++) {
|
for (i = 0; i < tx.inputs.length; i++) {
|
||||||
input = tx.inputs[i];
|
input = tx.inputs[i];
|
||||||
prevout = input.prevout.hash;
|
prevout = input.prevout;
|
||||||
|
|
||||||
if (br.readU8() === 0)
|
if (br.readU8() === 0)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -183,7 +183,7 @@ VerifyPacket.prototype.cmd = packetTypes.VERIFY;
|
|||||||
|
|
||||||
VerifyPacket.prototype.toWriter = function(bw) {
|
VerifyPacket.prototype.toWriter = function(bw) {
|
||||||
this.tx.toWriter(bw);
|
this.tx.toWriter(bw);
|
||||||
this.view.toWriter(bw, this.tx);
|
this.view.toFast(bw, this.tx);
|
||||||
bw.write32(this.flags != null ? this.flags : -1);
|
bw.write32(this.flags != null ? this.flags : -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ VerifyPacket.fromRaw = function fromRaw(TX, CoinView, data) {
|
|||||||
var packet = new VerifyPacket();
|
var packet = new VerifyPacket();
|
||||||
|
|
||||||
packet.tx = TX.fromReader(br);
|
packet.tx = TX.fromReader(br);
|
||||||
packet.view = CoinView.fromReader(br, packet.tx);
|
packet.view = CoinView.fromFast(br, packet.tx);
|
||||||
|
|
||||||
packet.flags = br.read32();
|
packet.flags = br.read32();
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ SignPacket.prototype.toWriter = function toWriter(bw) {
|
|||||||
var i, ring;
|
var i, ring;
|
||||||
|
|
||||||
this.tx.toWriter(bw);
|
this.tx.toWriter(bw);
|
||||||
this.tx.view.toWriter(bw, this.tx);
|
this.tx.view.toFast(bw, this.tx);
|
||||||
|
|
||||||
bw.writeVarint(this.rings.length);
|
bw.writeVarint(this.rings.length);
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ SignPacket.fromRaw = function fromRaw(MTX, KeyRing, data) {
|
|||||||
var i, count, ring;
|
var i, count, ring;
|
||||||
|
|
||||||
packet.tx = MTX.fromReader(br);
|
packet.tx = MTX.fromReader(br);
|
||||||
packet.tx.view.fromReader(br, packet.tx);
|
packet.tx.view.fromFast(br, packet.tx);
|
||||||
|
|
||||||
count = br.readVarint();
|
count = br.readVarint();
|
||||||
|
|
||||||
|
|||||||
@ -552,7 +552,7 @@ Worker.prototype._listen = function _listen() {
|
|||||||
self.killJobs();
|
self.killJobs();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('error', function() {
|
this.on('error', function(err) {
|
||||||
self.killJobs();
|
self.killJobs();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user