Skip to content

Commit

Permalink
Address validation
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasjones committed May 17, 2014
1 parent ab3dd2c commit e839dff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var base58 = require('base58-native');
var cnUtil = require('cryptonote-util');

exports.uid = function(){
var min = 100000000000000;
Expand Down Expand Up @@ -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;
}

};
};

0 comments on commit e839dff

Please sign in to comment.