From 6f345df01802d35cb6eae9300579de47692a0c43 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 5 Jul 2016 12:11:36 -0700 Subject: [PATCH] coins format. --- lib/bcoin/coins.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/bcoin/coins.js b/lib/bcoin/coins.js index 10ba7cda..3747bed6 100644 --- a/lib/bcoin/coins.js +++ b/lib/bcoin/coins.js @@ -213,7 +213,7 @@ Coins.prototype.toRaw = function toRaw(writer) { bits += 0x100000000; p.writeVarint(this.version); - p.writeVarint(bits); + p.writeU32(bits); field = new Buffer(Math.ceil(length / 8)); field.fill(0); @@ -296,7 +296,7 @@ Coins.prototype.fromRaw = function fromRaw(data, hash, index) { this.version = p.readVarint(); - bits = p.readVarint(); + bits = p.readU32(); this.height = bits >>> 1; this.hash = hash; @@ -332,7 +332,7 @@ Coins.prototype.fromRaw = function fromRaw(data, hash, index) { prefix = p.readU8(); // Skip past the compressed scripts. - switch (prefix & 3) { + switch (prefix) { case 0: p.seek(p.readVarint()); break; @@ -491,7 +491,7 @@ CompressedCoin.prototype.toCoin = function toCoin(coins, index) { prefix = p.readU8(); // Decompress the script. - switch (prefix & 3) { + switch (prefix) { case 0: coin.script.fromRaw(p.readVarBytes()); break;