From 137a166fe0b95ccdef444041e907358bd26bc226 Mon Sep 17 00:00:00 2001 From: Bitflash Date: Wed, 29 Jul 2026 12:05:12 -0300 Subject: Remove peer exchange from main; it was merged unreviewed (#27) PR #25 was opened, reviewed and approved as a single-file change to net.cpp: the .btf peer cache, +169/-0. I then pushed peer exchange and a /port option onto that same branch while the PR was open, which silently widened it to six files. The merge carried all of it in. Nothing about the peer exchange had been validated. Its two-node test never completed -- node B could not dial node A at all -- so what landed on main is unproven network protocol code that no one agreed to take. This restores main to what #25 actually described. The peer cache stays, with its runtime numbers (36.3s to 2.1s to first peer). #26 stays. What comes out: - the "btfpeers" message, both directions - BtfPexCollect / BtfPexAccept and the per-message caps - CNode::nLastPexRecv - the `desc` field on the cached peer record - BtfLocalDescriptor / BtfSecpContext - /port Peer exchange returns as its own pull request once its test passes. The /port option is worth having on its own -- two nodes cannot share a machine without it, which is what blocked the test -- and should go up separately rather than ride along again. Release v1.2.2 is unaffected: it was built from ba2de82, before either merge. --- src/nostr.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src/nostr.cpp') diff --git a/src/nostr.cpp b/src/nostr.cpp index 482a835..ec02c2e 100644 --- a/src/nostr.cpp +++ b/src/nostr.cpp @@ -342,36 +342,6 @@ std::string BtfLocalAddress() return g_nostrKey.BtfAddress(); } -// This node's own descriptor, signed and self-certifying -- the same blob -// PublishDescriptor puts on Nostr, but handed straight to a peer instead. -// -// Reads strBtfActiveRelay directly rather than going through BtfActiveRelay(): -// only a rendezvous we actually registered at is worth announcing. Handing out -// a meeting node we are not reachable at would make every peer that receives -// it burn a dial, and over peer exchange that mistake travels further than it -// does over Nostr. -std::string BtfLocalDescriptor() -{ - if (!EnsureNostrKey()) - return ""; - string meeting; - CRITICAL_BLOCK(cs_activeRelay) - meeting = strBtfActiveRelay; - if (meeting.empty()) - return ""; - return btf::SignDescriptor(g_nostrKey.ctx, g_nostrKey.seckey, - g_nostrKey.EncPubHex(), meeting, (uint64_t)GetTime()); -} - -// The shared secp256k1 context, so net.cpp can verify descriptors that arrive -// from peers. NULL if the identity could not be loaded. -void* BtfSecpContext() -{ - if (!EnsureNostrKey()) - return NULL; - return (void*)g_nostrKey.ctx; -} - int GetDiscoveredPeerCount() { int n = 0; -- cgit v1.2.3