From a801663c6da4eb52d932539d7e9b861dad36f55d Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Mon, 5 Jan 2015 17:31:51 -0500 Subject: [PATCH] Fixed bug in Safari for PublicKey and Script instance checking in Address --- lib/address.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/address.js b/lib/address.js index 96d1a06..b773f9d 100644 --- a/lib/address.js +++ b/lib/address.js @@ -213,8 +213,9 @@ Address._transformBuffer = function(buffer, network, type){ * @private */ Address._transformPublicKey = function(pubkey){ + var PublicKey = require('./publickey'); var info = {}; - if (!pubkey.constructor || (pubkey.constructor.name && pubkey.constructor.name !== 'PublicKey')) { + if (!(pubkey instanceof PublicKey)) { throw new TypeError('Address must be an instance of PublicKey.'); } info.hashBuffer = Hash.sha256ripemd160(pubkey.toBuffer()); @@ -230,8 +231,9 @@ Address._transformPublicKey = function(pubkey){ * @private */ Address._transformScript = function(script, network){ + var Script = require('./script'); var info = {}; - if (!script.constructor || (script.constructor.name && script.constructor.name !== 'Script')) { + if (!(script instanceof Script)) { throw new TypeError('Address must be an instance of Script.'); } if (script.isScriptHashOut()) {