Skip to content

Commit

Permalink
rpc: addressmap: Add ERC55 address validity check (#2607)
Browse files Browse the repository at this point in the history
* rpc: addressmap: Better error messages

* rpc: addressmap: add erc55 validity check

---------

Co-authored-by: Peter John Bushnell <[email protected]>
  • Loading branch information
prasannavl and Bushstar authored Oct 23, 2023
1 parent 96e950d commit 8597e7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4322,7 +4322,12 @@ UniValue addressmap(const JSONRPCRequest &request) {
if (key.IsCompressed()) {
key.Decompress();
}
format.pushKV("erc55", EncodeDestination(WitnessV16EthHash(key)));
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
AddrToPubKey(pwallet, erc55);
format.pushKV("erc55", erc55);
break;
}
case AddressConversionType::EVMToDVMAddress: {
Expand Down

0 comments on commit 8597e7d

Please sign in to comment.