aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-02-25 19:20:07 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-03-16 10:32:37 +0000
commitd29ea0455a34c2d08c681dacdf809e7f7317d2b3 (patch)
treedd0c0267049c52756c272d2e73964183d981e8b1 /src/wallet/wallet2.cpp
parentwallet: key reuse mitigation options (diff)
downloadmonero-d29ea0455a34c2d08c681dacdf809e7f7317d2b3.tar.xz
wallet: add an output blackball list to avoid using those in rings
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 6c71a81db..9cdb842ca 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -5541,16 +5541,43 @@ bool wallet2::find_and_save_rings(const std::string &filename, bool force)
return true;
}
-bool wallet2::tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, uint64_t global_index, const crypto::public_key& tx_public_key, const rct::key& mask, uint64_t real_index, bool unlocked) const
+bool wallet2::blackball_output(const crypto::public_key &output)
+{
+ return ringdb::blackball(get_ring_database(), output);
+}
+
+bool wallet2::set_blackballed_outputs(const std::vector<crypto::public_key> &outputs, bool add)
+{
+ bool ret = true;
+ if (!add)
+ ret &= ringdb::clear_blackballs(get_ring_database());
+ for (const auto &output: outputs)
+ ret &= ringdb::blackball(get_ring_database(), output);
+ return ret;
+}
+
+bool wallet2::unblackball_output(const crypto::public_key &output)
+{
+ return ringdb::unblackball(get_ring_database(), output);
+}
+
+bool wallet2::is_output_blackballed(const crypto::public_key &output) const
+{
+ return ringdb::blackballed(get_ring_database(), output);
+}
+
+bool wallet2::tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, uint64_t global_index, const crypto::public_key& output_public_key, const rct::key& mask, uint64_t real_index, bool unlocked) const
{
if (!unlocked) // don't add locked outs
return false;
if (global_index == real_index) // don't re-add real one
return false;
- auto item = std::make_tuple(global_index, tx_public_key, mask);
+ auto item = std::make_tuple(global_index, output_public_key, mask);
CHECK_AND_ASSERT_MES(!outs.empty(), false, "internal error: outs is empty");
if (std::find(outs.back().begin(), outs.back().end(), item) != outs.back().end()) // don't add duplicates
return false;
+ if (is_output_blackballed(output_public_key)) // don't add blackballed outputs
+ return false;
outs.back().push_back(item);
return true;
}