diff options
| author | Bitflash <btf01@proton.me> | 2026-07-29 12:05:12 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-29 12:05:12 -0300 |
| commit | 137a166fe0b95ccdef444041e907358bd26bc226 (patch) | |
| tree | bab295f18576f5d139bd7746f3c141fbbdfea3e2 /src/nostr.cpp | |
| parent | 96a8e42bbc313f96d54377ae5886da84298e61a3 (diff) | |
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.
Diffstat (limited to 'src/nostr.cpp')
| -rw-r--r-- | src/nostr.cpp | 30 |
1 files changed, 0 insertions, 30 deletions
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() | |||
| 342 | return g_nostrKey.BtfAddress(); | 342 | return g_nostrKey.BtfAddress(); |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | // This node's own descriptor, signed and self-certifying -- the same blob | ||
| 346 | // PublishDescriptor puts on Nostr, but handed straight to a peer instead. | ||
| 347 | // | ||
| 348 | // Reads strBtfActiveRelay directly rather than going through BtfActiveRelay(): | ||
| 349 | // only a rendezvous we actually registered at is worth announcing. Handing out | ||
| 350 | // a meeting node we are not reachable at would make every peer that receives | ||
| 351 | // it burn a dial, and over peer exchange that mistake travels further than it | ||
| 352 | // does over Nostr. | ||
| 353 | std::string BtfLocalDescriptor() | ||
| 354 | { | ||
| 355 | if (!EnsureNostrKey()) | ||
| 356 | return ""; | ||
| 357 | string meeting; | ||
| 358 | CRITICAL_BLOCK(cs_activeRelay) | ||
| 359 | meeting = strBtfActiveRelay; | ||
| 360 | if (meeting.empty()) | ||
| 361 | return ""; | ||
| 362 | return btf::SignDescriptor(g_nostrKey.ctx, g_nostrKey.seckey, | ||
| 363 | g_nostrKey.EncPubHex(), meeting, (uint64_t)GetTime()); | ||
| 364 | } | ||
| 365 | |||
| 366 | // The shared secp256k1 context, so net.cpp can verify descriptors that arrive | ||
| 367 | // from peers. NULL if the identity could not be loaded. | ||
| 368 | void* BtfSecpContext() | ||
| 369 | { | ||
| 370 | if (!EnsureNostrKey()) | ||
| 371 | return NULL; | ||
| 372 | return (void*)g_nostrKey.ctx; | ||
| 373 | } | ||
| 374 | |||
| 375 | int GetDiscoveredPeerCount() | 345 | int GetDiscoveredPeerCount() |
| 376 | { | 346 | { |
| 377 | int n = 0; | 347 | int n = 0; |