upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorBitflash <btf01@proton.me>2026-07-29 12:05:12 -0300
committerGitHub <noreply@github.com>2026-07-29 12:05:12 -0300
commit137a166fe0b95ccdef444041e907358bd26bc226 (patch)
treebab295f18576f5d139bd7746f3c141fbbdfea3e2 /src/net.h
parent96a8e42bbc313f96d54377ae5886da84298e61a3 (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/net.h')
-rw-r--r--src/net.h19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/net.h b/src/net.h
index 7d70721..f028c3b 100644
--- a/src/net.h
+++ b/src/net.h
@@ -29,21 +29,6 @@ CNode* ConnectNodeBtfResolved(const string& strBtfAddr, const string& strMeeting
29void ThreadBtfAccept(void* parg); 29void ThreadBtfAccept(void* parg);
30void ThreadBtfConnect(void* parg); 30void ThreadBtfConnect(void* parg);
31extern string strBtfConnect; 31extern string strBtfConnect;
32
33// --- .btf peer exchange ---------------------------------------------------
34// Peers gossip signed descriptors so discovery survives a relay outage. Both
35// caps apply to a single "btfpeers" message; the generic header limit is 256 MB,
36// which is no protection at all for something a stranger can send unprompted.
37static const unsigned int MAX_PEX_DESCRIPTORS = 20;
38static const unsigned int MAX_PEX_DESCRIPTOR_BYTES = 1024;
39// Ignore a peer's exchange more often than this. One announcement per side per
40// connection is the intended traffic; anything faster is someone else's idea.
41static const int64 PEX_MIN_INTERVAL = 60;
42
43// Descriptors to hand a peer: ours first, then peers that answered us.
44void BtfPexCollect(std::vector<std::string>& vDescOut);
45// Verify descriptors a peer sent and remember the good ones. Returns how many.
46int BtfPexAccept(const std::vector<std::string>& vDesc);
47void AbandonRequests(void (*fn)(void*, CDataStream&), void* param1); 32void AbandonRequests(void (*fn)(void*, CDataStream&), void* param1);
48bool AnySubscribed(unsigned int nChannel); 33bool AnySubscribed(unsigned int nChannel);
49void ThreadBitcoinMiner(void* parg); 34void ThreadBitcoinMiner(void* parg);
@@ -482,9 +467,6 @@ public:
482 // publish and subscription 467 // publish and subscription
483 vector<char> vfSubscribe; 468 vector<char> vfSubscribe;
484 469
485 // Last "btfpeers" we accepted from this node, to rate-limit the exchange.
486 int64 nLastPexRecv;
487
488 470
489 CNode(SOCKET hSocketIn, CAddress addrIn, bool fInboundIn=false) 471 CNode(SOCKET hSocketIn, CAddress addrIn, bool fInboundIn=false)
490 { 472 {
@@ -501,7 +483,6 @@ public:
501 fDisconnect = false; 483 fDisconnect = false;
502 nRefCount = 0; 484 nRefCount = 0;
503 nReleaseTime = 0; 485 nReleaseTime = 0;
504 nLastPexRecv = 0;
505 vfSubscribe.assign(256, false); 486 vfSubscribe.assign(256, false);
506 487
507 // Push a version message 488 // Push a version message