mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 05:13:25 +01:00
Rename "blackball" for clarity
Apparently some people seem to think it's a censorship list...
This commit is contained in:
parent
5c85da5a73
commit
99cd6f961a
@ -184,7 +184,7 @@ target_link_libraries(blockchain_blackball
|
||||
|
||||
set_property(TARGET blockchain_blackball
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-blackball")
|
||||
OUTPUT_NAME "monero-blockchain-mark-spent-outputs")
|
||||
install(TARGETS blockchain_blackball DESTINATION bin)
|
||||
|
||||
|
||||
|
@ -226,7 +226,7 @@ static void init(std::string cache_filename)
|
||||
bool tx_active = false;
|
||||
int dbr;
|
||||
|
||||
MINFO("Creating blackball cache in " << cache_filename);
|
||||
MINFO("Creating spent output cache in " << cache_filename);
|
||||
|
||||
tools::create_directories_if_necessary(cache_filename);
|
||||
|
||||
@ -1019,7 +1019,7 @@ int main(int argc, char* argv[])
|
||||
po::options_description desc_cmd_only("Command line options");
|
||||
po::options_description desc_cmd_sett("Command line options and settings options");
|
||||
const command_line::arg_descriptor<std::string> arg_blackball_db_dir = {
|
||||
"blackball-db-dir", "Specify blackball database directory",
|
||||
"spent-output-db-dir", "Specify spent output database directory",
|
||||
get_default_db_path(),
|
||||
};
|
||||
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
|
||||
@ -1076,7 +1076,7 @@ int main(int argc, char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
mlog_configure(mlog_get_default_log_path("monero-blockchain-blackball.log"), true);
|
||||
mlog_configure(mlog_get_default_log_path("monero-blockchain-find-spent-outputs.log"), true);
|
||||
if (!command_line::is_arg_defaulted(vm, arg_log_level))
|
||||
mlog_set_log(command_line::get_arg(vm, arg_log_level).c_str());
|
||||
else
|
||||
@ -1114,10 +1114,10 @@ int main(int argc, char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
const std::string cache_dir = (output_file_path / "blackball-cache").string();
|
||||
const std::string cache_dir = (output_file_path / "spent-outputs-cache").string();
|
||||
init(cache_dir);
|
||||
|
||||
LOG_PRINT_L0("Scanning for blackballable outputs...");
|
||||
LOG_PRINT_L0("Scanning for spent outputs...");
|
||||
|
||||
size_t done = 0;
|
||||
|
||||
@ -1215,7 +1215,7 @@ int main(int argc, char* argv[])
|
||||
const std::pair<uint64_t, uint64_t> output = std::make_pair(txin.amount, absolute[0]);
|
||||
if (opt_verbose)
|
||||
{
|
||||
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in a 1-ring");
|
||||
MINFO("Marking output " << output.first << "/" << output.second << " as spent, due to being used in a 1-ring");
|
||||
std::cout << "\r" << start_idx << "/" << n_txes << " \r" << std::flush;
|
||||
}
|
||||
blackballs.push_back(output);
|
||||
@ -1229,7 +1229,7 @@ int main(int argc, char* argv[])
|
||||
const std::pair<uint64_t, uint64_t> output = std::make_pair(txin.amount, absolute[o]);
|
||||
if (opt_verbose)
|
||||
{
|
||||
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in " << new_ring.size() << " identical " << new_ring.size() << "-rings");
|
||||
MINFO("Marking output " << output.first << "/" << output.second << " as spent, due to being used in " << new_ring.size() << " identical " << new_ring.size() << "-rings");
|
||||
std::cout << "\r" << start_idx << "/" << n_txes << " \r" << std::flush;
|
||||
}
|
||||
blackballs.push_back(output);
|
||||
@ -1244,7 +1244,7 @@ int main(int argc, char* argv[])
|
||||
const std::pair<uint64_t, uint64_t> output = std::make_pair(txin.amount, absolute[o]);
|
||||
if (opt_verbose)
|
||||
{
|
||||
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in " << new_ring.size() << " subsets of " << new_ring.size() << "-rings");
|
||||
MINFO("Marking output " << output.first << "/" << output.second << " as spent, due to being used in " << new_ring.size() << " subsets of " << new_ring.size() << "-rings");
|
||||
std::cout << "\r" << start_idx << "/" << n_txes << " \r" << std::flush;
|
||||
}
|
||||
blackballs.push_back(output);
|
||||
@ -1280,7 +1280,7 @@ int main(int argc, char* argv[])
|
||||
const std::pair<uint64_t, uint64_t> output = std::make_pair(txin.amount, common[0]);
|
||||
if (opt_verbose)
|
||||
{
|
||||
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in rings with a single common element");
|
||||
MINFO("Marking output " << output.first << "/" << output.second << " as spent, due to being used in rings with a single common element");
|
||||
std::cout << "\r" << start_idx << "/" << n_txes << " \r" << std::flush;
|
||||
}
|
||||
blackballs.push_back(output);
|
||||
@ -1392,7 +1392,7 @@ int main(int argc, char* argv[])
|
||||
const std::pair<uint64_t, uint64_t> output = std::make_pair(od.amount, last_unknown);
|
||||
if (opt_verbose)
|
||||
{
|
||||
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in a " <<
|
||||
MINFO("Marking output " << output.first << "/" << output.second << " as spent, due to being used in a " <<
|
||||
absolute.size() << "-ring where all other outputs are known to be spent");
|
||||
}
|
||||
blackballs.push_back(output);
|
||||
@ -1420,7 +1420,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
skip_secondary_passes:
|
||||
uint64_t diff = get_num_spent_outputs() - start_blackballed_outputs;
|
||||
LOG_PRINT_L0(std::to_string(diff) << " new outputs blackballed, " << get_num_spent_outputs() << " total outputs blackballed");
|
||||
LOG_PRINT_L0(std::to_string(diff) << " new outputs marked as spent, " << get_num_spent_outputs() << " total outputs marked as spent");
|
||||
|
||||
MDB_txn *txn;
|
||||
dbr = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
|
||||
@ -1460,7 +1460,7 @@ skip_secondary_passes:
|
||||
mdb_txn_abort(txn);
|
||||
}
|
||||
|
||||
LOG_PRINT_L0("Blockchain blackball data exported OK");
|
||||
LOG_PRINT_L0("Blockchain spent output data exported OK");
|
||||
close_db(env0, txn0, cur0, dbi0);
|
||||
close();
|
||||
return 0;
|
||||
|
@ -1640,7 +1640,7 @@ bool simple_wallet::blackball(const std::vector<std::string> &args)
|
||||
uint64_t amount = std::numeric_limits<uint64_t>::max(), offset, num_offsets;
|
||||
if (args.size() == 0)
|
||||
{
|
||||
fail_msg_writer() << tr("usage: blackball <amount>/<offset> | <filename> [add]");
|
||||
fail_msg_writer() << tr("usage: mark_output_spent <amount>/<offset> | <filename> [add]");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1718,7 +1718,7 @@ bool simple_wallet::blackball(const std::vector<std::string> &args)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to blackball output: ") << e.what();
|
||||
fail_msg_writer() << tr("Failed to mark output spent: ") << e.what();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1729,7 +1729,7 @@ bool simple_wallet::unblackball(const std::vector<std::string> &args)
|
||||
std::pair<uint64_t, uint64_t> output;
|
||||
if (args.size() != 1)
|
||||
{
|
||||
fail_msg_writer() << tr("usage: unblackball <amount>/<offset>");
|
||||
fail_msg_writer() << tr("usage: mark_output_unspent <amount>/<offset>");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1745,7 +1745,7 @@ bool simple_wallet::unblackball(const std::vector<std::string> &args)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to unblackball output: ") << e.what();
|
||||
fail_msg_writer() << tr("Failed to mark output unspent: ") << e.what();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1756,7 +1756,7 @@ bool simple_wallet::blackballed(const std::vector<std::string> &args)
|
||||
std::pair<uint64_t, uint64_t> output;
|
||||
if (args.size() != 1)
|
||||
{
|
||||
fail_msg_writer() << tr("usage: blackballed <amount>/<offset>");
|
||||
fail_msg_writer() << tr("usage: is_output_spent <amount>/<offset>");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1769,13 +1769,13 @@ bool simple_wallet::blackballed(const std::vector<std::string> &args)
|
||||
try
|
||||
{
|
||||
if (m_wallet->is_output_blackballed(output))
|
||||
message_writer() << tr("Blackballed: ") << output.first << "/" << output.second;
|
||||
message_writer() << tr("Spent: ") << output.first << "/" << output.second;
|
||||
else
|
||||
message_writer() << tr("not blackballed: ") << output.first << "/" << output.second;
|
||||
message_writer() << tr("Not spent: ") << output.first << "/" << output.second;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to unblackball output: ") << e.what();
|
||||
fail_msg_writer() << tr("Failed to check whether output is spent: ") << e.what();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -2599,18 +2599,18 @@ simple_wallet::simple_wallet()
|
||||
boost::bind(&simple_wallet::save_known_rings, this, _1),
|
||||
tr("save_known_rings"),
|
||||
tr("Save known rings to the shared rings database"));
|
||||
m_cmd_binder.set_handler("blackball",
|
||||
m_cmd_binder.set_handler("mark_output_spent",
|
||||
boost::bind(&simple_wallet::blackball, this, _1),
|
||||
tr("blackball <amount>/<offset> | <filename> [add]"),
|
||||
tr("Blackball output(s) so they never get selected as fake outputs in a ring"));
|
||||
m_cmd_binder.set_handler("unblackball",
|
||||
tr("mark_output_spent <amount>/<offset> | <filename> [add]"),
|
||||
tr("Mark output(s) as spent so they never get selected as fake outputs in a ring"));
|
||||
m_cmd_binder.set_handler("mark_output_unspent",
|
||||
boost::bind(&simple_wallet::unblackball, this, _1),
|
||||
tr("unblackball <amount>/<offset>"),
|
||||
tr("Unblackballs an output so it may get selected as a fake output in a ring"));
|
||||
m_cmd_binder.set_handler("blackballed",
|
||||
tr("mark_output_unspent <amount>/<offset>"),
|
||||
tr("Marks an output as unspent so it may get selected as a fake output in a ring"));
|
||||
m_cmd_binder.set_handler("is_output_spent",
|
||||
boost::bind(&simple_wallet::blackballed, this, _1),
|
||||
tr("blackballed <amount>/<offset>"),
|
||||
tr("Checks whether an output is blackballed"));
|
||||
tr("is_output_spent <amount>/<offset>"),
|
||||
tr("Checks whether an output is marked as spent"));
|
||||
m_cmd_binder.set_handler("version",
|
||||
boost::bind(&simple_wallet::version, this, _1),
|
||||
tr("version"),
|
||||
|
@ -2161,7 +2161,7 @@ bool WalletImpl::blackballOutputs(const std::vector<std::string> &outputs, bool
|
||||
bool ret = m_wallet->set_blackballed_outputs(raw_outputs, add);
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to set blackballed outputs"));
|
||||
setStatusError(tr("Failed to mark outputs as spent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -2183,7 +2183,7 @@ bool WalletImpl::blackballOutput(const std::string &amount, const std::string &o
|
||||
bool ret = m_wallet->blackball_output(std::make_pair(raw_amount, raw_offset));
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to blackball output"));
|
||||
setStatusError(tr("Failed to mark output as spent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -2205,7 +2205,7 @@ bool WalletImpl::unblackballOutput(const std::string &amount, const std::string
|
||||
bool ret = m_wallet->unblackball_output(std::make_pair(raw_amount, raw_offset));
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to unblackball output"));
|
||||
setStatusError(tr("Failed to mark output as unspent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -412,13 +412,13 @@ bool ringdb::blackball_worker(const std::vector<std::pair<uint64_t, uint64_t>> &
|
||||
switch (op)
|
||||
{
|
||||
case BLACKBALL_BLACKBALL:
|
||||
MDEBUG("Blackballing output " << output.first << "/" << output.second);
|
||||
MDEBUG("Marking output " << output.first << "/" << output.second << " as spent");
|
||||
dbr = mdb_cursor_put(cursor, &key, &data, MDB_APPENDDUP);
|
||||
if (dbr == MDB_KEYEXIST)
|
||||
dbr = 0;
|
||||
break;
|
||||
case BLACKBALL_UNBLACKBALL:
|
||||
MDEBUG("Unblackballing output " << output.first << "/" << output.second);
|
||||
MDEBUG("Marking output " << output.first << "/" << output.second << " as unspent");
|
||||
dbr = mdb_cursor_get(cursor, &key, &data, MDB_GET_BOTH);
|
||||
if (dbr == 0)
|
||||
dbr = mdb_cursor_del(cursor, 0);
|
||||
|
@ -6980,7 +6980,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
||||
// outputs, we still need to reach the minimum ring size)
|
||||
if (allow_blackballed)
|
||||
break;
|
||||
MINFO("Not enough non blackballed outputs, we'll allow blackballed ones");
|
||||
MINFO("Not enough output not marked as spent, we'll allow outputs marked as spent");
|
||||
allow_blackballed = true;
|
||||
num_usable_outs = num_outs;
|
||||
}
|
||||
|
@ -136,21 +136,21 @@ TEST(ringdb, different_genesis)
|
||||
ASSERT_FALSE(ringdb.get_ring(KEY_2, KEY_IMAGE_1, outs2));
|
||||
}
|
||||
|
||||
TEST(blackball, not_found)
|
||||
TEST(spent_outputs, not_found)
|
||||
{
|
||||
RingDB ringdb;
|
||||
ASSERT_TRUE(ringdb.blackball(OUTPUT_1));
|
||||
ASSERT_FALSE(ringdb.blackballed(OUTPUT_2));
|
||||
}
|
||||
|
||||
TEST(blackball, found)
|
||||
TEST(spent_outputs, found)
|
||||
{
|
||||
RingDB ringdb;
|
||||
ASSERT_TRUE(ringdb.blackball(OUTPUT_1));
|
||||
ASSERT_TRUE(ringdb.blackballed(OUTPUT_1));
|
||||
}
|
||||
|
||||
TEST(blackball, vector)
|
||||
TEST(spent_outputs, vector)
|
||||
{
|
||||
RingDB ringdb;
|
||||
std::vector<std::pair<uint64_t, uint64_t>> outputs;
|
||||
@ -174,7 +174,7 @@ TEST(blackball, vector)
|
||||
ASSERT_TRUE(ringdb.blackballed(std::make_pair(30, 5)));
|
||||
}
|
||||
|
||||
TEST(blackball, unblackball)
|
||||
TEST(spent_outputs, mark_as_unspent)
|
||||
{
|
||||
RingDB ringdb;
|
||||
ASSERT_TRUE(ringdb.blackball(OUTPUT_1));
|
||||
@ -182,7 +182,7 @@ TEST(blackball, unblackball)
|
||||
ASSERT_FALSE(ringdb.blackballed(OUTPUT_1));
|
||||
}
|
||||
|
||||
TEST(blackball, clear)
|
||||
TEST(spent_outputs, clear)
|
||||
{
|
||||
RingDB ringdb;
|
||||
ASSERT_TRUE(ringdb.blackball(OUTPUT_1));
|
||||
|
Loading…
Reference in New Issue
Block a user