Skip to content

Commit

Permalink
rpc: Refactor name_update to use new existsName method
Browse files Browse the repository at this point in the history
  • Loading branch information
yanmaani committed Oct 17, 2021
1 parent 1428d5f commit 1bac03f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/wallet/rpcnames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1087,12 +1087,12 @@ name_update ()
{
LOCK (cs_main);

CNameData oldData;
const auto& coinsTip = chainman.ActiveChainstate ().CoinsTip ();
if (!coinsTip.GetName (name, oldData)
|| oldData.isExpired (chainman.ActiveHeight ()))
if (!existsName (name, chainman))
throw JSONRPCError (RPC_TRANSACTION_ERROR,
"this name can not be updated");
CNameData oldData;
const auto& coinsTip = chainman.ActiveChainstate ().CoinsTip ();
coinsTip.GetName (name, oldData);
if (isDefaultVal)
value = oldData.getValue();
outp = oldData.getUpdateOutpoint ();
Expand Down

0 comments on commit 1bac03f

Please sign in to comment.