From e599f2f236d167cd7573cf73c833f936b08a1b90 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Mon, 23 Oct 2023 14:44:00 +0800 Subject: [PATCH] util: Remove obsolete check in addr conversions (#2608) * rpc: addressmap: Better error messages * rpc: addressmap: add erc55 validity check * Add const * util: Remove obsolete check --------- Co-authored-by: Peter John Bushnell --- src/rpc/util.cpp | 3 --- src/wallet/rpcwallet.cpp | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index c1bbd27801..305f242848 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -158,9 +158,6 @@ CPubKey AddrToPubKey(FillableSigningProvider* const keystore, const std::string& if (!keystore->GetPubKey(key, vchPubKey)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("no full public key for address %s", addr_in)); } - if (dest.index() == WitV16KeyEthHashType && vchPubKey.IsCompressed()) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("no valid public key for address %s", addr_in)); - } if (!vchPubKey.IsFullyValid()) { throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet contains an invalid public key"); } diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 1c99251e69..8063b4b749 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4322,7 +4322,7 @@ UniValue addressmap(const JSONRPCRequest &request) { if (key.IsCompressed()) { key.Decompress(); } - auto erc55 = EncodeDestination(WitnessV16EthHash(key)); + const auto erc55 = EncodeDestination(WitnessV16EthHash(key)); // Check if it's in the wallet. // Note: Can be removed if the full wallet is migrated. // Ref: https://github.com/DeFiCh/ain/issues/2604