diff --git a/lib/node/rpc.js b/lib/node/rpc.js index 7974de14..500de8cd 100644 --- a/lib/node/rpc.js +++ b/lib/node/rpc.js @@ -2212,15 +2212,16 @@ class RPC extends RPCBase { const ns = await this.chain.db.getNameState(nameHash); if (!ns || !ns.owner) - throw new RPCError(errs.TYPE_ERROR, 'Cannot find the name owner.'); + throw new RPCError(errs.MISC_ERROR, 'Cannot find the name owner.'); const coin = await this.chain.getCoin(ns.owner.hash, ns.owner.index); - if (!coin) + if (!coin) { throw new RPCError( - errs.INVALID_ADDRESS_OR_KEY, + errs.DATABASE_ERROR, 'Cannot find the owner\'s address.' ); + } const address = coin.address.toString(this.network); return this.verifyMessage([address, sig, str], help); diff --git a/lib/wallet/rpc.js b/lib/wallet/rpc.js index 6d792606..a142fa21 100644 --- a/lib/wallet/rpc.js +++ b/lib/wallet/rpc.js @@ -1606,15 +1606,16 @@ class RPC extends RPCBase { const ns = await wallet.getNameStateByName(name); if (!ns || !ns.owner) - throw new RPCError(errs.TYPE_ERROR, 'Cannot find the name owner.'); + throw new RPCError(errs.MISC_ERROR, 'Cannot find the name owner.'); const coin = await wallet.getCoin(ns.owner.hash, ns.owner.index); - if (!coin) + if (!coin) { throw new RPCError( - errs.INVALID_ADDRESS_OR_KEY, + errs.DATABASE_ERROR, 'Cannot find the owner\'s address.' ); + } const address = coin.address.toString(this.network); return this.signMessage([address, str], help);