Skip to content

Commit 986c223

Browse files
committed
[Wallet] print hd masterkeyid in getwalletinfo
1 parent b1c7b24 commit 986c223

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,6 +2269,7 @@ UniValue getwalletinfo(const UniValue& params, bool fHelp)
22692269
" \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
22702270
" \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
22712271
" \"paytxfee\": x.xxxx, (numeric) the transaction fee configuration, set in " + CURRENCY_UNIT + "/kB\n"
2272+
" \"masterkeyid\": \"<hash160>\", (string) the Hash160 of the hd master pubkey\n"
22722273
"}\n"
22732274
"\nExamples:\n"
22742275
+ HelpExampleCli("getwalletinfo", "")
@@ -2288,6 +2289,9 @@ UniValue getwalletinfo(const UniValue& params, bool fHelp)
22882289
if (pwalletMain->IsCrypted())
22892290
obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
22902291
obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK())));
2292+
CKeyID masterKeyID = pwalletMain->GetHDChain().masterKeyID;
2293+
if (!masterKeyID.IsNull())
2294+
obj.push_back(Pair("masterkeyid",masterKeyID.GetHex()));
22912295
return obj;
22922296
}
22932297

src/wallet/wallet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
901901

902902
/* Set the current hd master key (will reset the chain child index counters) */
903903
bool SetHDMasterKey(const CKey& key);
904+
const CHDChain& GetHDChain() { return hdChain; }
904905
};
905906

906907
/** A key allocated from the key pool. */

0 commit comments

Comments
 (0)