Skip to content

Commit

Permalink
Merge #911: [RPC] Return mining addresses in listaddresses rpc command
Browse files Browse the repository at this point in the history
6a00e1a display mining addresses in listaddresses rpc command (Rock-N-Troll)

Pull request description:

  `listaddresses` RPC command now handles mining addresses in the listaddresses command

  ![image](https://user-images.githubusercontent.com/34344520/112764551-1354d780-8fd7-11eb-8155-b7ff50a730c7.png)

  Addresses issue:  #863

Tree-SHA512: 7e79be54551b64e4a55c5ecd7c40e654579c4f98ba2f8ace846108979708441e914c20c4d436398aee528898bb94650d81eca4cd1e08cb784c57a5efb03a6903
  • Loading branch information
codeofalltrades committed Apr 10, 2021
2 parents 83db278 + 6a00e1a commit 01b2ee5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,8 @@ static UniValue listaddresses(const JSONRPCRequest& request)
{
// Only get basecoin and stealth addresses
if (!((item.first.type() == typeid(WitnessV0KeyHash)) ||
(item.first.type() == typeid(CStealthAddress)))) continue;
(item.first.type() == typeid(CStealthAddress)) ||
(item.first.type() == typeid(CKeyID)))) continue;
// Only get mine
if (!pwallet->IsMine(item.first)) continue;
// If we're balance only, require a balance
Expand All @@ -743,9 +744,12 @@ static UniValue listaddresses(const JSONRPCRequest& request)
if (item.first.type() == typeid(CStealthAddress)) {
entry.pushKV("address", EncodeDestination(item.first, true));
entry.pushKV("amount", ValueFromAmount(AnonBalances[item.first]));
} else {
} else if (item.first.type() == typeid(WitnessV0KeyHash)) {
entry.pushKV("address", EncodeDestination(item.first));
entry.pushKV("amount", ValueFromAmount(balances[item.first]));
} else {
entry.pushKV("address", EncodeDestination(item.first, false));
entry.pushKV("amount", ValueFromAmount(balances[item.first]));
}

entry.pushKV("label", item.second.name);
Expand Down

0 comments on commit 01b2ee5

Please sign in to comment.