diff options
| author | bitflash-maintainer <noreply@bitflash.invalid> | 2026-08-08 02:29:26 +0000 |
|---|---|---|
| committer | bitflash-maintainer <noreply@bitflash.invalid> | 2026-08-19 22:48:26 +0000 |
| commit | 541223daa6e6510daf3bdfdcb4dd4f6b0e38d877 (patch) | |
| tree | ec09f2f0bf24cc737bf978b4152df8a5a2e7fc07 /src/net.cpp | |
| parent | 68de575503c5df5e944278cecd3129cd10f2546e (diff) | |
pool: sync-gate job creation, retry failed payouts; widen nostr relay set
- RebuildJob: no jobs with zero peers or a tip older than 30min;
mining unsynced produced orphaned blocks and payouts that can
never be paid (observed in production: 8 orphan 'found blocks')
- payout exec: on SendMoney failure requeue with 60s backoff, up to
30 attempts, instead of silently forfeiting the payment
- nostr: add oxtr.dev, nos.social, fmt.wiz.biz, current.fyi, nostr.bg
(12 relays total) for announcement redundancy
(cherry picked from commit f1986cd7e4a6f69469a2256eb96ff03f3f146792)
Diffstat (limited to 'src/net.cpp')
| -rw-r--r-- | src/net.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp index 449d91c..5cf2f8c 100644 --- a/src/net.cpp +++ b/src/net.cpp | |||
| @@ -1054,6 +1054,18 @@ CNode* ConnectNodeBtfResolved(const string& strBtfAddr, const string& strMeeting | |||
| 1054 | void ThreadBtfAccept(void* parg) | 1054 | void ThreadBtfAccept(void* parg) |
| 1055 | { | 1055 | { |
| 1056 | printf("ThreadBtfAccept started\n"); | 1056 | printf("ThreadBtfAccept started\n"); |
| 1057 | // In operator mode the pool server registers this same node identity as a | ||
| 1058 | // stratum service at the rendezvous relays, and a relay only holds ONE | ||
| 1059 | // service registration per pubkey -- peer-accept and pool-accept would | ||
| 1060 | // kick each other off forever, breaking both. The pool's registration is | ||
| 1061 | // the one that must be stable (that's what miners resolve and dial), so | ||
| 1062 | // the node skips inbound rendezvous here and relies on outbound .btf | ||
| 1063 | // connections for block sync. | ||
| 1064 | if (nMineMode == MINE_OPERATOR) | ||
| 1065 | { | ||
| 1066 | printf("ThreadBtfAccept: operator mode -- skipping peer rendezvous registration\n"); | ||
| 1067 | return; | ||
| 1068 | } | ||
| 1057 | unsigned char pk[32]; | 1069 | unsigned char pk[32]; |
| 1058 | unsigned char sk[32]; | 1070 | unsigned char sk[32]; |
| 1059 | while (!BtfGetIdentity(pk, sk)) | 1071 | while (!BtfGetIdentity(pk, sk)) |
| @@ -1928,11 +1940,29 @@ bool StartNode(string& strError) | |||
| 1928 | { | 1940 | { |
| 1929 | int nErr = WSAGetLastError(); | 1941 | int nErr = WSAGetLastError(); |
| 1930 | if (nErr == WSAEADDRINUSE) | 1942 | if (nErr == WSAEADDRINUSE) |
| 1931 | strError = strprintf("Error: Unable to bind to port %s on this computer. The program is probably already running.", addrLocalHost.ToString().c_str()); | 1943 | { |
| 1944 | // Another local instance holds the default port. Fall back to an | ||
| 1945 | // ephemeral port: inbound direct-IP peering is optional, and .btf | ||
| 1946 | // rendezvous connectivity is unaffected by the local listen port. | ||
| 1947 | sockaddr.sin_port = htons(0); | ||
| 1948 | if (bind(hListenSocket, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) == SOCKET_ERROR) | ||
| 1949 | { | ||
| 1950 | strError = strprintf("Error: Unable to bind any port on this computer (bind returned error %d)", WSAGetLastError()); | ||
| 1951 | printf("%s\n", strError.c_str()); | ||
| 1952 | return false; | ||
| 1953 | } | ||
| 1954 | struct sockaddr_in bound; | ||
| 1955 | socklen_t nBoundLen = sizeof(bound); | ||
| 1956 | if (getsockname(hListenSocket, (struct sockaddr*)&bound, &nBoundLen) == 0) | ||
| 1957 | addrLocalHost.port = bound.sin_port; | ||
| 1958 | printf("default port in use by another instance; bound to ephemeral %s instead\n", addrLocalHost.ToString().c_str()); | ||
| 1959 | } | ||
| 1932 | else | 1960 | else |
| 1961 | { | ||
| 1933 | strError = strprintf("Error: Unable to bind to port %s on this computer (bind returned error %d)", addrLocalHost.ToString().c_str(), nErr); | 1962 | strError = strprintf("Error: Unable to bind to port %s on this computer (bind returned error %d)", addrLocalHost.ToString().c_str(), nErr); |
| 1934 | printf("%s\n", strError.c_str()); | 1963 | printf("%s\n", strError.c_str()); |
| 1935 | return false; | 1964 | return false; |
| 1965 | } | ||
| 1936 | } | 1966 | } |
| 1937 | printf("bound to addrLocalHost = %s\n\n", addrLocalHost.ToString().c_str()); | 1967 | printf("bound to addrLocalHost = %s\n\n", addrLocalHost.ToString().c_str()); |
| 1938 | 1968 | ||