Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkyourallmintvalidity #1292

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,38 @@ std::string AccountFromValue(const UniValue& value)
return strAccount;
}

UniValue checkyourallmintvalidity(const JSONRPCRequest& request)
{
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
assert(false || "Invalid wallet");
}

if (request.fHelp) {
throw std::runtime_error(
"checkyourallmintvalidity\n"
"checkyourallmintvalidity returns invalid(valid in your wallet but invalid from the outside) mints vector\n"
"\nResult\n"
"\"vector of invalid mints\""
"\n\nExamples:\n"
+ HelpExampleCli("checkyourallmintvalidity", "")
+ HelpExampleRpc("checkyourallmintvalidity", "")
);
}

const auto listMints = pwallet->zwallet->GetTracker().ListLelantusMints(true, false, false);
Scalar s;

UniValue usedMints(UniValue::VARR);

for (auto it = listMints.begin(); it != listMints.end(); ++it) {
if (lelantus::CLelantusState::GetState()->IsUsedCoinSerialHash(s, it->hashSerial)) {
usedMints.push_back(it->GetPubCoinValueHash().GetHex());
}
}
return usedMints;
}

UniValue getnewaddress(const JSONRPCRequest& request)
{
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
Expand Down Expand Up @@ -5506,6 +5538,7 @@ static const CRPCCommand commands[] =
{ "wallet", "addwitnessaddress", &addwitnessaddress, true, {"address"} },
{ "wallet", "backupwallet", &backupwallet, true, {"destination"} },
{ "wallet", "bumpfee", &bumpfee, true, {"txid", "options"} },
{ "wallet", "checkyourallmintvalidity", &checkyourallmintvalidity, true, {} },
{ "wallet", "dumpprivkey", &dumpprivkey_firo, true, {"address"} },
{ "wallet", "dumpwallet", &dumpwallet_firo, true, {"filename"} },
{ "wallet", "encryptwallet", &encryptwallet, true, {"passphrase"} },
Expand Down
Loading