From eae613d2442eee484920692cb1114a11c542e8d8 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Fri, 18 Apr 2014 06:48:40 +1000 Subject: [PATCH] Adds error messages and better version checking --- src/address.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/address.js b/src/address.js index c519147..3a52de0 100644 --- a/src/address.js +++ b/src/address.js @@ -4,9 +4,9 @@ var crypto = require('./crypto') var network = require('./network') function Address(hash, version) { - assert(Buffer.isBuffer(hash)) - assert(hash.length === 20) - assert(typeof version === 'number') + assert(Buffer.isBuffer(hash), 'First argument must be a Buffer') + assert.strictEqual(hash.length, 20, 'Invalid hash length') + assert.strictEqual(version & 0xFF, version, 'Invalid version byte') this.hash = hash this.version = version