From 63dd7c7dec8ca1b1fe4a56e2f99f99652909f8d4 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 26 Mar 2014 19:11:37 +1100 Subject: [PATCH] Now uses varIntToNum --- src/transaction.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/transaction.js b/src/transaction.js index fa9566d..caaf22f 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -254,11 +254,11 @@ Transaction.deserialize = function(buffer) { return buffer[pos-1] + readAsInt(bytes-1) * 256; } var readVarInt = function() { - pos++; - if (buffer[pos-1] < 253) { - return buffer[pos-1]; - } - return readAsInt(buffer[pos-1] - 251); + var bytes = buffer.slice(pos, pos + 9) // maximum possible number of bytes to read + var result = convert.varIntToNum(bytes) + + pos += result.bytes.length + return result.number } var readBytes = function(bytes) { pos += bytes;