From 5759c157162e3b5857e6c3470fdbcab4bcf3c4ce Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 2 Dec 2023 18:55:11 +0100 Subject: [PATCH] dont sync messages not witnessed by self --- solanaceae/zox/ngc_hs.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/solanaceae/zox/ngc_hs.cpp b/solanaceae/zox/ngc_hs.cpp index 7664806..9b01f98 100644 --- a/solanaceae/zox/ngc_hs.cpp +++ b/solanaceae/zox/ngc_hs.cpp @@ -12,6 +12,7 @@ #include #include #include +#include void ZoxNGCHistorySync::subscribeToEvents(void) { _zngcepi.subscribe(this, ZoxNGC_Event::ngch_request); @@ -265,9 +266,27 @@ bool ZoxNGCHistorySync::onEvent(const Events::ZoxNGC_ngch_request& e) { } if (ts.ts < ts_start) { - std::cout << "---- " << ts.ts << " < " << ts_start << " -> too old\n"; + //std::cout << "---- " << ts.ts << " < " << ts_start << " -> too old\n"; return; } + + if (reg.all_of(e)) { + const auto& list = reg.get(e).list; + if ( + std::find_if( + list.cbegin(), list.cend(), + [this](const auto& it) { + // TODO: add weak self + return _cr.all_of(it); + } + ) == list.cend() + ) { + // self not found + // TODO: config for self only + return; + } + } + std::cout << "---- " << ts.ts << " >= " << ts_start << " -> selected\n"; msg_send_queue.push(e);