diff --git a/lib/address.js b/lib/address.js index 264b9ef..ff1ffa9 100644 --- a/lib/address.js +++ b/lib/address.js @@ -3,8 +3,8 @@ var constants = require('./constants'); var Hash = require('./hash'); var Pubkey = require('./pubkey'); -function Address(hash, network, type) { - this.hash = hash; +function Address(hashbuf, network, type) { + this.hashbuf = hashbuf; this.network = network; this.type = type; }; @@ -12,7 +12,7 @@ function Address(hash, network, type) { Address.prototype.fromPubkey = function(pubkey, network, compressed) { if (typeof compressed === 'undefined') compressed = true; - this.hash = Hash.sha256ripemd160(pubkey.toDER(compressed)); + this.hashbuf = Hash.sha256ripemd160(pubkey.toDER(compressed)); this.network = network || 'mainnet'; this.type = 'pubkeyhash'; return this; @@ -40,7 +40,7 @@ Address.prototype.fromString = function(str) { this.type = 'unknown'; } - this.hash = buf.slice(1); + this.hashbuf = buf.slice(1); } Address.prototype.isValid = function() { @@ -54,7 +54,7 @@ Address.prototype.isValid = function() { Address.prototype.toBuffer = function() { version = new Buffer([constants[this.network][this.type]]); - var buf = Buffer.concat([version, this.hash]); + var buf = Buffer.concat([version, this.hashbuf]); return buf; }; @@ -63,7 +63,7 @@ Address.prototype.toString = function() { }; Address.prototype.validate = function() { - if (!Buffer.isBuffer(this.hash) || this.hash.length !== 20) + if (!Buffer.isBuffer(this.hashbuf) || this.hashbuf.length !== 20) throw new Error('hash must be a buffer of 20 bytes'); if (this.network !== 'mainnet' && this.network !== 'testnet') throw new Error('network must be "mainnet" or "testnet"');