diff options
| author | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-20 15:37:44 -0300 |
|---|---|---|
| committer | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-20 16:08:01 -0300 |
| commit | 28a2656d22a193fcd92d225964da5a01e8183623 (patch) | |
| tree | da4ce79046b258edc1ebc7e0343c696205f26fb2 /src/net.h | |
| parent | 0714027dc6fc7266841eeb088a0c52b6db64a62f (diff) | |
net: add isolated testnet parameters
Diffstat (limited to 'src/net.h')
| -rw-r--r-- | src/net.h | 20 |
1 files changed, 13 insertions, 7 deletions
| @@ -13,7 +13,8 @@ class CBlockIndex; | |||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | static const unsigned short DEFAULT_PORT = htons(8433); | 16 | static const unsigned short MAINNET_PORT = 8433; |
| 17 | static const unsigned short TESTNET_PORT = 18433; | ||
| 17 | static const unsigned int PUBLISH_HOPS = 5; | 18 | static const unsigned int PUBLISH_HOPS = 5; |
| 18 | enum | 19 | enum |
| 19 | { | 20 | { |
| @@ -26,6 +27,9 @@ enum | |||
| 26 | 27 | ||
| 27 | 28 | ||
| 28 | bool GetMyExternalIP(unsigned int& ipRet); | 29 | bool GetMyExternalIP(unsigned int& ipRet); |
| 30 | bool IsTestNet(); | ||
| 31 | unsigned short GetDefaultPort(); | ||
| 32 | void SelectNetworkParams(bool fTestNetIn); | ||
| 29 | CNode* ConnectNodeBtf(const string& strBtfAddr); | 33 | CNode* ConnectNodeBtf(const string& strBtfAddr); |
| 30 | CNode* ConnectNodeBtfResolved(const string& strBtfAddr, const string& strMeeting, | 34 | CNode* 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 |
| 224 | static const char pchMessageStart[4] = { 0xbf, 0x20, 0x5c, 0xfd }; | 228 | // mainnet before consensus-level testnet activation exists. |
| 229 | extern char pchMessageStart[4]; | ||
| 225 | 230 | ||
| 226 | class CMessageHeader | 231 | class CMessageHeader |
| 227 | { | 232 | { |
| 228 | public: | 233 | public: |
| 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 | ||