walletdb: switch to u32s to potentially avoid deserialization.

This commit is contained in:
Christopher Jeffrey 2016-11-07 14:11:17 -08:00
parent 827ab4b539
commit 93d2c8811f
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 7 additions and 7 deletions

View File

@ -244,7 +244,7 @@ function BlockMapRecord(height) {
BlockMapRecord.prototype.fromRaw = function fromRaw(data) {
var p = new BufferReader(data);
var count = p.readVarint();
var count = p.readU32();
var i, hash, tx;
for (i = 0; i < count; i++) {
@ -278,7 +278,7 @@ BlockMapRecord.prototype.toRaw = function toRaw(writer) {
var p = new BufferWriter(writer);
var i, tx;
p.writeVarint(this.txs.length);
p.writeU32(this.txs.length);
for (i = 0; i < this.txs.length; i++) {
tx = this.txs[i];
@ -450,7 +450,7 @@ function cmpid(a, b) {
function parseWallets(data) {
var p = new BufferReader(data);
var count = p.readVarint();
var count = p.readU32();
var wids = [];
var i;
@ -464,7 +464,7 @@ function serializeWallets(wids, writer) {
var p = new BufferWriter(writer);
var i, wid;
p.writeVarint(wids.length);
p.writeU32(wids.length);
for (i = 0; i < wids.length; i++) {
wid = wids[i];

View File

@ -3442,7 +3442,7 @@ BlockRecord.prototype.fromRaw = function fromRaw(data) {
this.height = p.readU32();
this.ts = p.readU32();
count = p.readVarint();
count = p.readU32();
for (i = 0; i < count; i++) {
hash = p.readHash('hex');
@ -3477,7 +3477,7 @@ BlockRecord.prototype.toRaw = function toRaw(writer) {
p.writeU32(this.height);
p.writeU32(this.ts);
p.writeVarint(this.hashes.length);
p.writeU32(this.hashes.length);
for (i = 0; i < this.hashes.length; i++)
p.writeHash(this.hashes[i]);

View File

@ -143,7 +143,7 @@ function serializeWallets(wids, writer) {
var p = new BufferWriter(writer);
var i, wid;
p.writeVarint(wids.length);
p.writeU32(wids.length);
for (i = 0; i < wids.length; i++) {
wid = wids[i];