Fixed bug in Safari for PublicKey and Script instance checking in Address

This commit is contained in:
Braydon Fuller 2015-01-05 17:31:51 -05:00
parent 6fb5c4771f
commit a801663c6d
1 changed files with 4 additions and 2 deletions

View File

@ -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()) {