Control: forwarded -1 https://github.com/monero-project/monero/issues/9314
Control: tags -1 patch

This could fix the error. Can you please test this?
From: Bastian Germann <[email protected]>
Subject: net: fall back to unfiltered outgoing peers for Dandelion++ stem when none match local height

After initial sync the local blockchain height jumps to the tip while
outgoing peers have not yet advertised an updated height.  This caused
get_out_connections() to return an empty list, which collapsed the
Dandelion++ stem selection to a nil UUID and silently degraded to a
fluff broadcast, losing transaction origin privacy.

Fix by retrying without the height filter when the filtered list is
empty, so stem routing is preserved at the cost of possibly forwarding
to a slightly behind peer.

Fixes: "Unable to send transaction(s) via Dandelion++ stem" on first
use after synchronisation (reported in monero-project/monero#9314).
---
--- a/src/cryptonote_protocol/levin_notify.cpp
+++ b/src/cryptonote_protocol/levin_notify.cpp
@@ -153,6 +153,22 @@ namespace levin
       });
 
       MDEBUG("Found " << outs.size() << " out connections having height >= " << blockchain_height);
+
+      if (outs.empty())
+      {
+        /* No peers have reported being at our height yet (e.g. right after
+           initial sync). Fall back to any outgoing connection so Dandelion++
+           stem is preserved rather than collapsing to a fluff broadcast and
+           losing privacy. */
+        p2p.foreach_connection([&outs] (detail::p2p_context& context) {
+          if (!context.m_is_income)
+            outs.emplace_back(context.m_connection_id);
+          return true;
+        });
+        if (!outs.empty())
+          MDEBUG("No out connections at current height; using " << outs.size() << " unfiltered out connection(s) for Dandelion++ stem");
+      }
+
       return outs;
     }
 

Reply via email to