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:
authorNsable-sh <nsable-sh@noreply.git.bitflash.network>2026-08-20 15:37:44 -0300
committerNsable-sh <nsable-sh@noreply.git.bitflash.network>2026-08-20 16:08:01 -0300
commit28a2656d22a193fcd92d225964da5a01e8183623 (patch)
treeda4ce79046b258edc1ebc7e0343c696205f26fb2 /src/net.h
parent0714027dc6fc7266841eeb088a0c52b6db64a62f (diff)
net: add isolated testnet parameters
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/net.h b/src/net.h
index e3d4a93..56f1341 100644
--- a/src/net.h
+++ b/src/net.h
@@ -13,7 +13,8 @@ class CBlockIndex;
13 13
14 14
15 15
16static const unsigned short DEFAULT_PORT = htons(8433); 16static const unsigned short MAINNET_PORT = 8433;
17static const unsigned short TESTNET_PORT = 18433;
17static const unsigned int PUBLISH_HOPS = 5; 18static const unsigned int PUBLISH_HOPS = 5;
18enum 19enum
19{ 20{
@@ -26,6 +27,9 @@ enum
26 27
27 28
28bool GetMyExternalIP(unsigned int& ipRet); 29bool GetMyExternalIP(unsigned int& ipRet);
30bool IsTestNet();
31unsigned short GetDefaultPort();
32void SelectNetworkParams(bool fTestNetIn);
29CNode* ConnectNodeBtf(const string& strBtfAddr); 33CNode* ConnectNodeBtf(const string& strBtfAddr);
30CNode* ConnectNodeBtfResolved(const string& strBtfAddr, const string& strMeeting, 34CNode* ConnectNodeBtfResolved(const string& strBtfAddr, const string& strMeeting,
31 const string& strOnion, const unsigned char enc_pub[32], 35 const string& strOnion, const unsigned char enc_pub[32],
@@ -219,15 +223,17 @@ void CheckForShutdown(int n);
219// The message start string is designed to be unlikely to occur in normal data. 223// The message start string is designed to be unlikely to occur in normal data.
220// The characters are rarely used upper ascii, not valid as UTF-8, and produce 224// The characters are rarely used upper ascii, not valid as UTF-8, and produce
221// a large 4-byte int at any alignment. 225// a large 4-byte int at any alignment.
222// Magic bytes unique to the Bitflash network (0xbf = "BF"). Second byte bumped 226// Magic bytes unique to the selected Bitflash network. Mainnet uses 0xbf =
223// to 0x20 for the 2026 stable relaunch so the old test chain can't interfere. 227// "BF"; testnet swaps the whole sequence so a test node cannot handshake with
224static const char pchMessageStart[4] = { 0xbf, 0x20, 0x5c, 0xfd }; 228// mainnet before consensus-level testnet activation exists.
229extern char pchMessageStart[4];
225 230
226class CMessageHeader 231class CMessageHeader
227{ 232{
228public: 233public:
229 enum { COMMAND_SIZE=12 }; 234 enum { COMMAND_SIZE=12 };
230 char pchMessageStart[sizeof(::pchMessageStart)]; 235 enum { MESSAGE_START_SIZE=4 };
236 char pchMessageStart[MESSAGE_START_SIZE];
231 char pchCommand[COMMAND_SIZE]; 237 char pchCommand[COMMAND_SIZE];
232 unsigned int nMessageSize; 238 unsigned int nMessageSize;
233 239
@@ -318,7 +324,7 @@ public:
318 nServices = 0; 324 nServices = 0;
319 memcpy(pchReserved, pchIPv4, sizeof(pchReserved)); 325 memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
320 ip = 0; 326 ip = 0;
321 port = DEFAULT_PORT; 327 port = GetDefaultPort();
322 nTime = GetAdjustedTime(); 328 nTime = GetAdjustedTime();
323 nLastFailed = 0; 329 nLastFailed = 0;
324 } 330 }
@@ -348,7 +354,7 @@ public:
348 nServices = nServicesIn; 354 nServices = nServicesIn;
349 memcpy(pchReserved, pchIPv4, sizeof(pchReserved)); 355 memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
350 ip = 0; 356 ip = 0;
351 port = DEFAULT_PORT; 357 port = GetDefaultPort();
352 nTime = GetAdjustedTime(); 358 nTime = GetAdjustedTime();
353 nLastFailed = 0; 359 nLastFailed = 0;
354 360