Specify that cleanwallettransactions only works on utxos, not zutxos

This commit is contained in:
Duke Leto
2021-05-15 12:15:00 -04:00
parent 860541d2e4
commit d977345b26

View File

@@ -1103,7 +1103,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp, const CPubK
if (fHelp || params.size() > 1 ) if (fHelp || params.size() > 1 )
throw runtime_error( throw runtime_error(
"cleanwallettransactions \"txid\"\n" "cleanwallettransactions \"txid\"\n"
"\nRemove all txs that are spent. You can clear all txs bar one, by specifiying a txid.\n" "\nRemove all transparent UTXOs that are spent. You can clear all transactions bar one, by specifiying a txid.\n"
"\nPlease backup your wallet.dat before running this command.\n" "\nPlease backup your wallet.dat before running this command.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, optional) The transaction id to keep.\n" "1. \"txid\" (string, optional) The transaction id to keep.\n"
@@ -1133,9 +1133,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp, const CPubK
if ( !pwalletMain->IsMine(tmp_tx) ) if ( !pwalletMain->IsMine(tmp_tx) )
{ {
throw runtime_error("\nThe transaction is not yours!\n"); throw runtime_error("\nThe transaction is not yours!\n");
} } else {
else
{
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
{ {
const CWalletTx& wtx = (*it).second; const CWalletTx& wtx = (*it).second;
@@ -1145,14 +1143,10 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp, const CPubK
} }
} }
} }
} } else {
else
{
throw runtime_error("\nThe transaction could not be found!\n"); throw runtime_error("\nThe transaction could not be found!\n");
} }
} } else {
else
{
// get all locked utxos to relock them later. // get all locked utxos to relock them later.
vector<COutPoint> vLockedUTXO; vector<COutPoint> vLockedUTXO;
pwalletMain->ListLockedCoins(vLockedUTXO); pwalletMain->ListLockedCoins(vLockedUTXO);