Adds error messages and better version checking
This commit is contained in:
parent
682ec133bb
commit
eae613d244
1 changed files with 3 additions and 3 deletions
|
@ -4,9 +4,9 @@ var crypto = require('./crypto')
|
||||||
var network = require('./network')
|
var network = require('./network')
|
||||||
|
|
||||||
function Address(hash, version) {
|
function Address(hash, version) {
|
||||||
assert(Buffer.isBuffer(hash))
|
assert(Buffer.isBuffer(hash), 'First argument must be a Buffer')
|
||||||
assert(hash.length === 20)
|
assert.strictEqual(hash.length, 20, 'Invalid hash length')
|
||||||
assert(typeof version === 'number')
|
assert.strictEqual(version & 0xFF, version, 'Invalid version byte')
|
||||||
|
|
||||||
this.hash = hash
|
this.hash = hash
|
||||||
this.version = version
|
this.version = version
|
||||||
|
|
Loading…
Reference in a new issue