diff options
| author | bitflash-maintainer <noreply@bitflash.invalid> | 2026-09-05 05:08:30 +0000 |
|---|---|---|
| committer | bitflash-maintainer <noreply@bitflash.invalid> | 2026-09-05 05:08:30 +0000 |
| commit | 66e0b9158d050c46b1ff2509faeee3f4573cac1c (patch) | |
| tree | 7e9132aa871fdc01cb95268d2f5ea3bb11853ddf /src/net.h | |
| parent | 36201d2795b7b49beb1a837b0252134096beb64d (diff) | |
| parent | 17741d9cf4c762ea03dc83e8aae6a176e5f338b0 (diff) | |
Merge upstream/main into the fork
Brings the nine commits that are actually the latest on our lineage:
isolated testnet parameters and genesis, optional 2 MB large pages for
RandomX, and five README changes. This is what "up to date" means here --
not the 1.2.2x tags, which carry higher version numbers but were cut
2026-07-30, three weeks before the line we ship, and which upstream/main
does not contain.
Three conflicts, all resolved toward upstream's structure while keeping
what this fork knows:
main.cpp -- upstream moved genesis construction into BuildGenesisBlock() so
mainnet and the new testnet can share it. Verified byte-for-byte before
taking it: MAINNET_GENESIS_TIMESTAMP, _TIME (1753315200), _NONCE (3141),
_HASH, _MERKLE, the scriptPubKey, nBits and nVersion all equal what this
tree built inline. The mainnet genesis hash is unchanged and the asserts
still guard it. Kept our warning about never editing those inputs, and kept
our note that 1753315200 is 2025-07-24, not 2026 -- upstream's comment on
that constant states the wrong year.
net.h -- DEFAULT_PORT = htons(8433) becomes MAINNET_PORT/TESTNET_PORT in
host order. Nothing is lost: net.cpp's GetDefaultPort() applies htons()
itself and is what every caller uses, so the value reaching a sockaddr is
unchanged and mainnet stays on 8433.
selftest.cpp -- the known-tests string had diverged in both directions.
Took the union: upstream's network-params alongside our payout-ledger,
rather than dropping either.
Gates: 15/15 selftests (our 14 plus upstream's network-params), consensus
constants unchanged against e4f898c except the pre-existing
MAX_BLOCK_SIZE_GEN, mainnet genesis intact, compactblock's 17 checks still
pass, money-log check ok, GNU_STACK RW.
Diffstat (limited to 'src/net.h')
| -rw-r--r-- | src/net.h | 25 |
1 files changed, 18 insertions, 7 deletions
| @@ -12,7 +12,13 @@ class CBlockIndex; | |||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | static const unsigned short DEFAULT_PORT = htons(8433); | 15 | // Held in host byte order, unlike the DEFAULT_PORT constant these replace, |
| 16 | // which was htons(8433). Nothing is lost: net.cpp's GetDefaultPort() applies | ||
| 17 | // htons() itself and is what every caller now uses, so the value that reaches | ||
| 18 | // a sockaddr is byte-for-byte what it was. Mainnet stays on 8433. | ||
| 19 | static const unsigned short MAINNET_PORT = 8433; | ||
| 20 | static const unsigned short TESTNET_PORT = 18433; | ||
| 21 | static const unsigned int PUBLISH_HOPS = 5; | ||
| 16 | enum | 22 | enum |
| 17 | { | 23 | { |
| 18 | NODE_NETWORK = (1 << 0), | 24 | NODE_NETWORK = (1 << 0), |
| @@ -30,6 +36,9 @@ enum | |||
| 30 | bool IsBlockFetchNearTip(); | 36 | bool IsBlockFetchNearTip(); |
| 31 | 37 | ||
| 32 | bool GetMyExternalIP(unsigned int& ipRet); | 38 | bool GetMyExternalIP(unsigned int& ipRet); |
| 39 | bool IsTestNet(); | ||
| 40 | unsigned short GetDefaultPort(); | ||
| 41 | void SelectNetworkParams(bool fTestNetIn); | ||
| 33 | CNode* ConnectNodeBtf(const string& strBtfAddr); | 42 | CNode* ConnectNodeBtf(const string& strBtfAddr); |
| 34 | CNode* ConnectNodeBtfResolved(const string& strBtfAddr, const string& strMeeting, | 43 | CNode* ConnectNodeBtfResolved(const string& strBtfAddr, const string& strMeeting, |
| 35 | const string& strOnion, const unsigned char enc_pub[32], | 44 | const string& strOnion, const unsigned char enc_pub[32], |
| @@ -266,15 +275,17 @@ void CheckForShutdown(int n); | |||
| 266 | // The message start string is designed to be unlikely to occur in normal data. | 275 | // The message start string is designed to be unlikely to occur in normal data. |
| 267 | // The characters are rarely used upper ascii, not valid as UTF-8, and produce | 276 | // The characters are rarely used upper ascii, not valid as UTF-8, and produce |
| 268 | // a large 4-byte int at any alignment. | 277 | // a large 4-byte int at any alignment. |
| 269 | // Magic bytes unique to the Bitflash network (0xbf = "BF"). Second byte bumped | 278 | // Magic bytes unique to the selected Bitflash network. Mainnet uses 0xbf = |
| 270 | // to 0x20 for the 2026 stable relaunch so the old test chain can't interfere. | 279 | // "BF"; testnet swaps the whole sequence so a test node cannot handshake with |
| 271 | static const char pchMessageStart[4] = { 0xbf, 0x20, 0x5c, 0xfd }; | 280 | // mainnet before consensus-level testnet activation exists. |
| 281 | extern char pchMessageStart[4]; | ||
| 272 | 282 | ||
| 273 | class CMessageHeader | 283 | class CMessageHeader |
| 274 | { | 284 | { |
| 275 | public: | 285 | public: |
| 276 | enum { COMMAND_SIZE=12 }; | 286 | enum { COMMAND_SIZE=12 }; |
| 277 | char pchMessageStart[sizeof(::pchMessageStart)]; | 287 | enum { MESSAGE_START_SIZE=4 }; |
| 288 | char pchMessageStart[MESSAGE_START_SIZE]; | ||
| 278 | char pchCommand[COMMAND_SIZE]; | 289 | char pchCommand[COMMAND_SIZE]; |
| 279 | unsigned int nMessageSize; | 290 | unsigned int nMessageSize; |
| 280 | 291 | ||
| @@ -365,7 +376,7 @@ public: | |||
| 365 | nServices = 0; | 376 | nServices = 0; |
| 366 | memcpy(pchReserved, pchIPv4, sizeof(pchReserved)); | 377 | memcpy(pchReserved, pchIPv4, sizeof(pchReserved)); |
| 367 | ip = 0; | 378 | ip = 0; |
| 368 | port = DEFAULT_PORT; | 379 | port = GetDefaultPort(); |
| 369 | nTime = GetAdjustedTime(); | 380 | nTime = GetAdjustedTime(); |
| 370 | nLastFailed = 0; | 381 | nLastFailed = 0; |
| 371 | } | 382 | } |
| @@ -395,7 +406,7 @@ public: | |||
| 395 | nServices = nServicesIn; | 406 | nServices = nServicesIn; |
| 396 | memcpy(pchReserved, pchIPv4, sizeof(pchReserved)); | 407 | memcpy(pchReserved, pchIPv4, sizeof(pchReserved)); |
| 397 | ip = 0; | 408 | ip = 0; |
| 398 | port = DEFAULT_PORT; | 409 | port = GetDefaultPort(); |
| 399 | nTime = GetAdjustedTime(); | 410 | nTime = GetAdjustedTime(); |
| 400 | nLastFailed = 0; | 411 | nLastFailed = 0; |
| 401 | 412 | ||