From e839dff5ec407680b9450ada7f5f12c2413a02b5 Mon Sep 17 00:00:00 2001 From: lucas Date: Sat, 17 May 2014 16:52:14 +0100 Subject: [PATCH] Address validation --- lib/utils.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index be32ac5f..2801720b 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,4 +1,5 @@ var base58 = require('base58-native'); +var cnUtil = require('cryptonote-util'); exports.uid = function(){ var min = 100000000000000; @@ -50,11 +51,11 @@ exports.isValidAddress = function(addr){ if (addr.length !== 95) return false; try{ - var decoded = base58.decode(addr); - return true; + var decoded = cnUtil.address_decode(new Buffer(addr)); + return decoded.length > 0; } catch(e){ return false; } -}; \ No newline at end of file +};