z_listlockunspent

This commit is contained in:
Duke
2025-08-20 15:15:36 -04:00
parent c6892b950b
commit cae942a5c9
3 changed files with 41 additions and 0 deletions

View File

@@ -2645,6 +2645,45 @@ UniValue lockunspent(const UniValue& params, bool fHelp, const CPubKey& mypk)
return true;
}
UniValue z_listlockunspent(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
if (fHelp || params.size() > 0)
throw runtime_error(
"z_listlockunspent\n"
"\nReturns list of temporarily unspendable outputs.\n"
"\nResult:\n"
"[\n"
" {\n"
" \"txid\" : \"transactionid\", (string) The transaction id locked\n"
" \"vout\" : n (numeric) The vout value\n"
" }\n"
" ,...\n"
"]\n"
"\nExamples:\n"
"\nList the locked Sapling notes\n"
+ HelpExampleCli("z_listlockunspent", "") +
"\nAs a json rpc call\n"
+ HelpExampleRpc("z_listlockunspent", "")
);
LOCK2(cs_main, pwalletMain->cs_wallet);
vector<SaplingOutPoint> ops = pwalletMain->ListLockedSaplingNotes();
UniValue ret(UniValue::VARR);
BOOST_FOREACH(SaplingOutPoint &op, ops) {
UniValue o(UniValue::VOBJ);
o.push_back(Pair("txid", op.hash.GetHex()));
ret.push_back(o);
}
return ret;
}
UniValue listlockunspent(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (!EnsureWalletIsAvailable(fHelp))