aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol/block_queue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cryptonote_protocol/block_queue.cpp')
-rw-r--r--src/cryptonote_protocol/block_queue.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/block_queue.cpp b/src/cryptonote_protocol/block_queue.cpp
index 8a78c7562..583c3abf4 100644
--- a/src/cryptonote_protocol/block_queue.cpp
+++ b/src/cryptonote_protocol/block_queue.cpp
@@ -76,6 +76,22 @@ void block_queue::flush_spans(const boost::uuids::uuid &connection_id, bool all)
}
}
+void block_queue::flush_stale_spans(const std::set<boost::uuids::uuid> &live_connections)
+{
+ boost::unique_lock<boost::recursive_mutex> lock(mutex);
+ block_map::iterator i = blocks.begin();
+ if (i != blocks.end() && is_blockchain_placeholder(*i))
+ ++i;
+ while (i != blocks.end())
+ {
+ block_map::iterator j = i++;
+ if (live_connections.find(j->connection_id) == live_connections.end() && j->blocks.size() == 0)
+ {
+ blocks.erase(j);
+ }
+ }
+}
+
void block_queue::remove_span(uint64_t start_block_height)
{
boost::unique_lock<boost::recursive_mutex> lock(mutex);