mempool: load descFee/descSize correctly.

This commit is contained in:
Christopher Jeffrey 2017-02-28 13:35:13 -08:00
parent 6dcbb93802
commit e80c98d4e8
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 9 additions and 6 deletions

View File

@ -118,6 +118,11 @@ Mempool.prototype._open = co(function* open() {
entry = entries[i]; entry = entries[i];
this.trackEntry(entry); this.trackEntry(entry);
} }
for (i = 0; i < entries.length; i++) {
entry = entries[i];
this.updateAncestors(entry);
}
} }
this.logger.info('Mempool loaded (maxsize=%dkb).', size); this.logger.info('Mempool loaded (maxsize=%dkb).', size);
@ -2301,7 +2306,7 @@ function MempoolCache(options) {
this.db = LDB(options); this.db = LDB(options);
} }
MempoolCache.VERSION = 0; MempoolCache.VERSION = 1;
MempoolCache.prototype.getVersion = co(function* getVersion() { MempoolCache.prototype.getVersion = co(function* getVersion() {
var data = yield this.db.get(layout.V); var data = yield this.db.get(layout.V);

View File

@ -195,7 +195,7 @@ MempoolEntry.prototype.isFree = function isFree(height) {
*/ */
MempoolEntry.prototype.getSize = function getSize() { MempoolEntry.prototype.getSize = function getSize() {
return this.tx.getSize() + 53; return this.tx.getSize() + 41;
}; };
/** /**
@ -214,8 +214,6 @@ MempoolEntry.prototype.toRaw = function toRaw() {
bw.writeU32(this.ts); bw.writeU32(this.ts);
bw.writeU64(this.value); bw.writeU64(this.value);
bw.writeU8(this.dependencies ? 1 : 0); bw.writeU8(this.dependencies ? 1 : 0);
bw.writeU64(this.descFee);
bw.writeU32(this.descSize);
return bw.render(); return bw.render();
}; };
@ -237,8 +235,8 @@ MempoolEntry.prototype.fromRaw = function fromRaw(data) {
this.ts = br.readU32(); this.ts = br.readU32();
this.value = br.readU64(); this.value = br.readU64();
this.dependencies = br.readU8() === 1; this.dependencies = br.readU8() === 1;
this.descFee = br.readU64(); this.descFee = this.fee;
this.descSize = br.readU32(); this.descSize = this.size;
return this; return this;
}; };