diff options
Diffstat (limited to 'src/main_gui.cpp')
| -rw-r--r-- | src/main_gui.cpp | 75 |
1 files changed, 71 insertions, 4 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 943799f..2743429 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp | |||
| @@ -123,6 +123,9 @@ static void PrintUsage() | |||
| 123 | printf("Mining mode:\n"); | 123 | printf("Mining mode:\n"); |
| 124 | printf(" /operator\n"); | 124 | printf(" /operator\n"); |
| 125 | printf(" /participant=POOL_BTF_ADDRESS\n"); | 125 | printf(" /participant=POOL_BTF_ADDRESS\n"); |
| 126 | printf(" /payoutaddr=BTF_ADDRESS (participant: pay shares to this address, no wallet needed)\n"); | ||
| 127 | printf(" /payoutfile=FILE (participant: rotate payout addresses from file)\n"); | ||
| 128 | printf(" /hashthreads=N (participant: mining threads, default cores-1)\n"); | ||
| 126 | printf(" /stratumbridge=POOL_BTF_ADDRESS\n"); | 129 | printf(" /stratumbridge=POOL_BTF_ADDRESS\n"); |
| 127 | printf(" /stratumbridgeport=N (default 3333; listen on 127.0.0.1)\n"); | 130 | printf(" /stratumbridgeport=N (default 3333; listen on 127.0.0.1)\n"); |
| 128 | printf(" /solomine\n"); | 131 | printf(" /solomine\n"); |
| @@ -147,6 +150,7 @@ static void PrintUsage() | |||
| 147 | printf(" /socks=HOST:PORT (SOCKS5 proxy for Nostr, .btf relay, and onion dials)\n"); | 150 | printf(" /socks=HOST:PORT (SOCKS5 proxy for Nostr, .btf relay, and onion dials)\n"); |
| 148 | printf(" /tor[=HOST:PORT] (Tor mode; default SOCKS5 proxy is 127.0.0.1:9050)\n"); | 151 | printf(" /tor[=HOST:PORT] (Tor mode; default SOCKS5 proxy is 127.0.0.1:9050)\n"); |
| 149 | printf(" /managedtor[=PATH] (start Tor, create a hidden service, advertise its onion)\n"); | 152 | printf(" /managedtor[=PATH] (start Tor, create a hidden service, advertise its onion)\n"); |
| 153 | printf(" /automanagedtor (auto-start a bundled Tor if one sits next to the executable)\n"); | ||
| 150 | printf(" /nomanagedtor (disable automatic bundled Tor startup)\n"); | 154 | printf(" /nomanagedtor (disable automatic bundled Tor startup)\n"); |
| 151 | printf(" /oniononly (do not fall back to rendezvous when a .btf onion dial fails)\n"); | 155 | printf(" /oniononly (do not fall back to rendezvous when a .btf onion dial fails)\n"); |
| 152 | printf(" /btfseed=ADDRESS:ENCHEX (extra bootstrap peer, repeatable)\n"); | 156 | printf(" /btfseed=ADDRESS:ENCHEX (extra bootstrap peer, repeatable)\n"); |
| @@ -234,7 +238,7 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 234 | if (!strProcLimit.empty()) | 238 | if (!strProcLimit.empty()) |
| 235 | { | 239 | { |
| 236 | int n = atoi(strProcLimit.c_str()); | 240 | int n = atoi(strProcLimit.c_str()); |
| 237 | unsigned int nCores = std::thread::hardware_concurrency(); | 241 | unsigned int nCores = AvailableCoreCount(); |
| 238 | if (n < 0) | 242 | if (n < 0) |
| 239 | fprintf(stderr, "Ignoring /genproclimit=%s: not a thread count\n", | 243 | fprintf(stderr, "Ignoring /genproclimit=%s: not a thread count\n", |
| 240 | strProcLimit.c_str()); | 244 | strProcLimit.c_str()); |
| @@ -260,6 +264,18 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 260 | fMineModeFromCommandLine = true; | 264 | fMineModeFromCommandLine = true; |
| 261 | } | 265 | } |
| 262 | 266 | ||
| 267 | string payoutAddr = argval2(argc, argv, "/payoutaddr", "-payoutaddr"); | ||
| 268 | if (!payoutAddr.empty()) | ||
| 269 | strPayoutAddress = payoutAddr; | ||
| 270 | |||
| 271 | string payoutFile = argval2(argc, argv, "/payoutfile", "-payoutfile"); | ||
| 272 | if (!payoutFile.empty()) | ||
| 273 | strPayoutFile = payoutFile; | ||
| 274 | |||
| 275 | string hashThreads = argval2(argc, argv, "/hashthreads", "-hashthreads"); | ||
| 276 | if (!hashThreads.empty()) | ||
| 277 | nHashThreads = atoi(hashThreads.c_str()); | ||
| 278 | |||
| 263 | if (arg(argc,argv,"/stratumbridge") || arg(argc,argv,"-stratumbridge")) | 279 | if (arg(argc,argv,"/stratumbridge") || arg(argc,argv,"-stratumbridge")) |
| 264 | { | 280 | { |
| 265 | fStratumBridge = true; | 281 | fStratumBridge = true; |
| @@ -286,6 +302,12 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 286 | if (!poolDash.empty()) | 302 | if (!poolDash.empty()) |
| 287 | strPoolDashboardUrl = poolDash; | 303 | strPoolDashboardUrl = poolDash; |
| 288 | 304 | ||
| 305 | if (arg(argc,argv,"/noannounce") || arg(argc,argv,"-noannounce")) | ||
| 306 | fPoolNoAnnounce = true; | ||
| 307 | |||
| 308 | if (arg(argc,argv,"/poolmineblind") || arg(argc,argv,"-poolmineblind")) | ||
| 309 | fPoolMineBlind = true; | ||
| 310 | |||
| 289 | string poolFee = argval2(argc, argv, "/poolfee", "-poolfee"); | 311 | string poolFee = argval2(argc, argv, "/poolfee", "-poolfee"); |
| 290 | if (!poolFee.empty()) | 312 | if (!poolFee.empty()) |
| 291 | dPoolFeePercent = atof(poolFee.c_str()); | 313 | dPoolFeePercent = atof(poolFee.c_str()); |
| @@ -306,8 +328,20 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 306 | string rvRelay = argval2(argc, argv, "/rvrelay", "-rvrelay"); | 328 | string rvRelay = argval2(argc, argv, "/rvrelay", "-rvrelay"); |
| 307 | if (!rvRelay.empty()) | 329 | if (!rvRelay.empty()) |
| 308 | { | 330 | { |
| 309 | vBtfMeetingRelays.clear(); | 331 | if (!LooksLikeRelay(rvRelay)) |
| 310 | vBtfMeetingRelays.push_back(rvRelay); | 332 | { |
| 333 | // A malformed pin must not replace the seed list: with the pin | ||
| 334 | // set, no discovered relay can ever mask the typo, and the pool | ||
| 335 | // would publish a garbage (or no) meeting node forever. | ||
| 336 | fprintf(stderr, "Ignoring /rvrelay=%s: expected host:port\n", | ||
| 337 | rvRelay.c_str()); | ||
| 338 | } | ||
| 339 | else | ||
| 340 | { | ||
| 341 | vBtfMeetingRelays.clear(); | ||
| 342 | vBtfMeetingRelays.push_back(rvRelay); | ||
| 343 | fBtfRelayPinned = true; | ||
| 344 | } | ||
| 311 | } | 345 | } |
| 312 | 346 | ||
| 313 | // net.cpp has described nListenPort as "tunable via /port" since it was | 347 | // net.cpp has described nListenPort as "tunable via /port" since it was |
| @@ -348,8 +382,16 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 348 | bool fTorMode = arg(argc, argv, "/tor") || arg(argc, argv, "-tor"); | 382 | bool fTorMode = arg(argc, argv, "/tor") || arg(argc, argv, "-tor"); |
| 349 | string socksProxy = argval2(argc, argv, "/socks", "-socks"); | 383 | string socksProxy = argval2(argc, argv, "/socks", "-socks"); |
| 350 | string bundledTorPath; | 384 | string bundledTorPath; |
| 385 | // Managed Tor is opt-in on this fork. Upstream 1.2.19 auto-starts a | ||
| 386 | // bundled tor whenever one sits next to the executable, which silently | ||
| 387 | // moves Nostr/.btf traffic onto Tor, creates a hidden service, and starts | ||
| 388 | // publishing descriptors with meeting_node="rendezvous-pending" on nodes | ||
| 389 | // that never asked for it -- against our pinned-relay posture. The | ||
| 390 | // upstream behavior remains available under the explicit /automanagedtor. | ||
| 351 | bool fAutoManagedTor = !fManagedTor && !fNoManagedTor && !fTorMode && | 391 | bool fAutoManagedTor = !fManagedTor && !fNoManagedTor && !fTorMode && |
| 352 | socksProxy.empty() && BtfBundledTorPath(bundledTorPath); | 392 | socksProxy.empty() && |
| 393 | (arg(argc, argv, "/automanagedtor") || arg(argc, argv, "-automanagedtor")) && | ||
| 394 | BtfBundledTorPath(bundledTorPath); | ||
| 353 | if (fManagedTor || fAutoManagedTor) | 395 | if (fManagedTor || fAutoManagedTor) |
| 354 | { | 396 | { |
| 355 | if (fManagedTor && (fTorMode || !socksProxy.empty())) | 397 | if (fManagedTor && (fTorMode || !socksProxy.empty())) |
| @@ -1030,6 +1072,31 @@ int main(int argc, char* argv[]) | |||
| 1030 | 1072 | ||
| 1031 | ReacceptWalletTransactions(); | 1073 | ReacceptWalletTransactions(); |
| 1032 | 1074 | ||
| 1075 | // /dumpaddresses=N:FILE -- generate N fresh wallet keys and write their | ||
| 1076 | // addresses (one per line) to FILE, then exit. Keys stay in this wallet; | ||
| 1077 | // the file alone is enough for a miner elsewhere to rotate payout | ||
| 1078 | // addresses via /payoutfile. (No HD/xpub exists in this wallet format.) | ||
| 1079 | string dumpSpec = argval2(argc, argv, "/dumpaddresses", "-dumpaddresses"); | ||
| 1080 | if (!dumpSpec.empty()) | ||
| 1081 | { | ||
| 1082 | size_t colon = dumpSpec.rfind(':'); | ||
| 1083 | if (colon == string::npos) { fprintf(stderr, "usage: /dumpaddresses=N:FILE\n"); return 1; } | ||
| 1084 | int n = atoi(dumpSpec.substr(0, colon).c_str()); | ||
| 1085 | string file = dumpSpec.substr(colon + 1); | ||
| 1086 | FILE* f = fopen(file.c_str(), "w"); | ||
| 1087 | if (!f) { fprintf(stderr, "cannot open %s\n", file.c_str()); return 1; } | ||
| 1088 | for (int i = 0; i < n; i++) | ||
| 1089 | { | ||
| 1090 | CKey key; | ||
| 1091 | key.MakeNewKey(); | ||
| 1092 | if (!AddKey(key)) { fclose(f); fprintf(stderr, "AddKey failed at %d\n", i); return 1; } | ||
| 1093 | fprintf(f, "%s\n", PubKeyToAddress(key.GetPubKey()).c_str()); | ||
| 1094 | } | ||
| 1095 | fclose(f); | ||
| 1096 | printf("wrote %d fresh wallet addresses to %s\n", n, file.c_str()); | ||
| 1097 | return 0; | ||
| 1098 | } | ||
| 1099 | |||
| 1033 | if (!StartNode(strErrors)) | 1100 | if (!StartNode(strErrors)) |
| 1034 | { | 1101 | { |
| 1035 | fprintf(stderr,"StartNode: %s\n",strErrors.c_str()); | 1102 | fprintf(stderr,"StartNode: %s\n",strErrors.c_str()); |