blockchain_blackball: use a bit less memory

This commit is contained in:
moneromooo-monero 2018-07-30 17:22:01 +01:00
parent 0dddfeacc9
commit 361513ac81
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 3 additions and 4 deletions

View File

@ -436,7 +436,6 @@ int main(int argc, char* argv[])
MINFO("Blackballing output " << pkey << ", due to being used in a 1-ring"); MINFO("Blackballing output " << pkey << ", due to being used in a 1-ring");
ringdb.blackball(pkey); ringdb.blackball(pkey);
newly_spent.insert(output_data(txin.amount, absolute[0])); newly_spent.insert(output_data(txin.amount, absolute[0]));
state.spent.insert(output_data(txin.amount, absolute[0]));
} }
else if (state.ring_instances[new_ring] == new_ring.size()) else if (state.ring_instances[new_ring] == new_ring.size())
{ {
@ -446,7 +445,6 @@ int main(int argc, char* argv[])
MINFO("Blackballing output " << pkey << ", due to being used in " << new_ring.size() << " identical " << new_ring.size() << "-rings"); MINFO("Blackballing output " << pkey << ", due to being used in " << new_ring.size() << " identical " << new_ring.size() << "-rings");
ringdb.blackball(pkey); ringdb.blackball(pkey);
newly_spent.insert(output_data(txin.amount, absolute[o])); newly_spent.insert(output_data(txin.amount, absolute[o]));
state.spent.insert(output_data(txin.amount, absolute[o]));
} }
} }
else if (state.relative_rings.find(txin.k_image) != state.relative_rings.end()) else if (state.relative_rings.find(txin.k_image) != state.relative_rings.end())
@ -475,7 +473,6 @@ int main(int argc, char* argv[])
MINFO("Blackballing output " << pkey << ", due to being used in rings with a single common element"); MINFO("Blackballing output " << pkey << ", due to being used in rings with a single common element");
ringdb.blackball(pkey); ringdb.blackball(pkey);
newly_spent.insert(output_data(txin.amount, common[0])); newly_spent.insert(output_data(txin.amount, common[0]));
state.spent.insert(output_data(txin.amount, common[0]));
} }
else else
{ {
@ -500,6 +497,9 @@ int main(int argc, char* argv[])
std::unordered_set<output_data> work_spent = std::move(newly_spent); std::unordered_set<output_data> work_spent = std::move(newly_spent);
newly_spent.clear(); newly_spent.clear();
for (const auto &e: work_spent)
state.spent.insert(e);
for (const output_data &od: work_spent) for (const output_data &od: work_spent)
{ {
for (const crypto::key_image &ki: state.outputs[od]) for (const crypto::key_image &ki: state.outputs[od])
@ -522,7 +522,6 @@ int main(int argc, char* argv[])
absolute.size() << "-ring where all other outputs are known to be spent"); absolute.size() << "-ring where all other outputs are known to be spent");
ringdb.blackball(pkey); ringdb.blackball(pkey);
newly_spent.insert(output_data(od.amount, last_unknown)); newly_spent.insert(output_data(od.amount, last_unknown));
state.spent.insert(output_data(od.amount, last_unknown));
} }
} }
} }