Skip to content
Permalink
Browse files

Address-Fix: Correct the validation function

Add sub-addresses to the global validation func for XMR
  • Loading branch information
Snipa22 committed Dec 20, 2019
1 parent 2326257 commit 2ae92ca0b0e71e4762f45d27a8fcd425d8223609
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/coins/xmr.js
@@ -33,12 +33,13 @@ function Coin(data){

this.prefix = 18;
this.intPrefix = 19;
this.subPrefix = 42;

if (global.config.general.testnet === true){
if (global.config.general.testnet === true) {
this.prefix = 53;
this.intPrefix = 54;
this.subPrefix = 63;
}

this.supportsAutoExchange = true;

this.niceHashDiff = 400000;
@@ -89,10 +90,11 @@ function Coin(data){
return bignum('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 16);
};

this.validateAddress = function(address){
this.validateAddress = function (address) {
// This function should be able to be called from the async library, as we need to BLOCK ever so slightly to verify the address.
address = new Buffer(address);
if (cnUtil.address_decode(address) === this.prefix){
let decoded_address = cnUtil.address_decode(address);
if (decoded_address === this.prefix || decoded_address === this.subPrefix) {
return true;
}
return cnUtil.address_decode_integrated(address) === this.intPrefix;

0 comments on commit 2ae92ca

Please sign in to comment.
You can’t perform that action at this time.