mempoolentry: improve serialization.

This commit is contained in:
Christopher Jeffrey 2017-02-28 10:41:59 -08:00
parent 7ccea6fbb8
commit 3ac91b9a77
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -195,7 +195,7 @@ MempoolEntry.prototype.isFree = function isFree(height) {
*/
MempoolEntry.prototype.getSize = function getSize() {
return this.tx.getSize() + 37;
return this.tx.getSize() + 49;
};
/**
@ -212,8 +212,10 @@ MempoolEntry.prototype.toRaw = function toRaw() {
bw.writeDouble(this.priority);
bw.writeU32(this.fee);
bw.writeU32(this.ts);
bw.write64(this.value);
bw.writeU64(this.value);
bw.writeU8(this.dependencies ? 1 : 0);
bw.writeU64(this.descFee);
bw.writeU32(this.descSize);
return bw.render();
};
@ -233,8 +235,10 @@ MempoolEntry.prototype.fromRaw = function fromRaw(data) {
this.priority = br.readDouble();
this.fee = br.readU32();
this.ts = br.readU32();
this.value = br.read64();
this.value = br.readU64();
this.dependencies = br.readU8() === 1;
this.descFee = br.readU64();
this.descSize = br.readU32();
return this;
};