walletdb: switch to u32s to potentially avoid deserialization.
This commit is contained in:
parent
827ab4b539
commit
93d2c8811f
@ -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];
|
||||
|
||||
@ -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]);
|
||||
|
||||
@ -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];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user