Skip to content

Commit

Permalink
fix(ENS): register subdomain when not registered
Browse files Browse the repository at this point in the history
was introduced when we did para deploy
We didn't register on error, but the error is the queue to register
  • Loading branch information
jrainville committed Nov 29, 2018
1 parent 801932b commit ca212e3
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/lib/modules/ens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ZERO_ADDRESS } from '../../utils/addressUtils';
import {ens} from '../../constants';

const ENS_WHITELIST = ens.whitelist;
const NOT_REGISTERED_ERROR = 'Name not yet registered';

const MAINNET_ID = '1';
const ROPSTEN_ID = '3';
Expand Down Expand Up @@ -183,7 +184,7 @@ class ENS {
return cb(err);
}
if (resolverAddress === ZERO_ADDRESS) {
return cb('Name not yet registered');
return cb(NOT_REGISTERED_ERROR);
}
next(null, resolverAddress);
});
Expand Down Expand Up @@ -227,9 +228,9 @@ class ENS {
return eachCb();
}

if (error) {
this.logger.error(error);
return eachCb();
if (error !== NOT_REGISTERED_ERROR) {
this.logger.error(__('Error resolving %s', `${subDomainName}.${this.registration.rootDomain}`));
return eachCb(error);
}

const reverseNode = utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix);
Expand Down Expand Up @@ -485,7 +486,7 @@ class ENS {
return next(err);
}
if(resolverAddress === ZERO_ADDRESS) {
return next('Name not yet registered');
return next(NOT_REGISTERED_ERROR);
}
next(null, resolverAddress);
});
Expand All @@ -500,13 +501,7 @@ class ENS {
function resolveName(resolverContract, next) {
resolverContract.methods.addr(hashedName).call(next);
}
], (err, result) => {
if (err) {
self.logger.error(__('Failed to resolve the ENS name: %s', name));
return cb(err);
}
cb(null, result);
});
], cb);
}

isENSName(name, callback = () => {}) {
Expand Down

0 comments on commit ca212e3

Please sign in to comment.