diff options
Diffstat (limited to 'src/main_gui.cpp')
| -rw-r--r-- | src/main_gui.cpp | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 3f52e91..e8dacd3 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp | |||
| @@ -119,6 +119,9 @@ static void PrintUsage() | |||
| 119 | printf("Mining mode:\n"); | 119 | printf("Mining mode:\n"); |
| 120 | printf(" /operator\n"); | 120 | printf(" /operator\n"); |
| 121 | printf(" /participant=POOL_BTF_ADDRESS\n"); | 121 | printf(" /participant=POOL_BTF_ADDRESS\n"); |
| 122 | printf(" /payoutaddr=BTF_ADDRESS (participant: pay shares to this address, no wallet needed)\n"); | ||
| 123 | printf(" /payoutfile=FILE (participant: rotate payout addresses from file)\n"); | ||
| 124 | printf(" /hashthreads=N (participant: mining threads, default cores-1)\n"); | ||
| 122 | printf(" /stratumbridge=POOL_BTF_ADDRESS\n"); | 125 | printf(" /stratumbridge=POOL_BTF_ADDRESS\n"); |
| 123 | printf(" /stratumbridgeport=N (default 3333; listen on 127.0.0.1)\n"); | 126 | printf(" /stratumbridgeport=N (default 3333; listen on 127.0.0.1)\n"); |
| 124 | printf(" /solomine\n"); | 127 | printf(" /solomine\n"); |
| @@ -213,7 +216,7 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 213 | if (!strProcLimit.empty()) | 216 | if (!strProcLimit.empty()) |
| 214 | { | 217 | { |
| 215 | int n = atoi(strProcLimit.c_str()); | 218 | int n = atoi(strProcLimit.c_str()); |
| 216 | unsigned int nCores = std::thread::hardware_concurrency(); | 219 | unsigned int nCores = AvailableCoreCount(); |
| 217 | if (n < 0) | 220 | if (n < 0) |
| 218 | fprintf(stderr, "Ignoring /genproclimit=%s: not a thread count\n", | 221 | fprintf(stderr, "Ignoring /genproclimit=%s: not a thread count\n", |
| 219 | strProcLimit.c_str()); | 222 | strProcLimit.c_str()); |
| @@ -239,6 +242,18 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 239 | fMineModeFromCommandLine = true; | 242 | fMineModeFromCommandLine = true; |
| 240 | } | 243 | } |
| 241 | 244 | ||
| 245 | string payoutAddr = argval2(argc, argv, "/payoutaddr", "-payoutaddr"); | ||
| 246 | if (!payoutAddr.empty()) | ||
| 247 | strPayoutAddress = payoutAddr; | ||
| 248 | |||
| 249 | string payoutFile = argval2(argc, argv, "/payoutfile", "-payoutfile"); | ||
| 250 | if (!payoutFile.empty()) | ||
| 251 | strPayoutFile = payoutFile; | ||
| 252 | |||
| 253 | string hashThreads = argval2(argc, argv, "/hashthreads", "-hashthreads"); | ||
| 254 | if (!hashThreads.empty()) | ||
| 255 | nHashThreads = atoi(hashThreads.c_str()); | ||
| 256 | |||
| 242 | if (arg(argc,argv,"/stratumbridge") || arg(argc,argv,"-stratumbridge")) | 257 | if (arg(argc,argv,"/stratumbridge") || arg(argc,argv,"-stratumbridge")) |
| 243 | { | 258 | { |
| 244 | fStratumBridge = true; | 259 | fStratumBridge = true; |
| @@ -265,6 +280,12 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 265 | if (!poolDash.empty()) | 280 | if (!poolDash.empty()) |
| 266 | strPoolDashboardUrl = poolDash; | 281 | strPoolDashboardUrl = poolDash; |
| 267 | 282 | ||
| 283 | if (arg(argc,argv,"/noannounce") || arg(argc,argv,"-noannounce")) | ||
| 284 | fPoolNoAnnounce = true; | ||
| 285 | |||
| 286 | if (arg(argc,argv,"/poolmineblind") || arg(argc,argv,"-poolmineblind")) | ||
| 287 | fPoolMineBlind = true; | ||
| 288 | |||
| 268 | string poolFee = argval2(argc, argv, "/poolfee", "-poolfee"); | 289 | string poolFee = argval2(argc, argv, "/poolfee", "-poolfee"); |
| 269 | if (!poolFee.empty()) | 290 | if (!poolFee.empty()) |
| 270 | dPoolFeePercent = atof(poolFee.c_str()); | 291 | dPoolFeePercent = atof(poolFee.c_str()); |
| @@ -285,8 +306,20 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 285 | string rvRelay = argval2(argc, argv, "/rvrelay", "-rvrelay"); | 306 | string rvRelay = argval2(argc, argv, "/rvrelay", "-rvrelay"); |
| 286 | if (!rvRelay.empty()) | 307 | if (!rvRelay.empty()) |
| 287 | { | 308 | { |
| 288 | vBtfMeetingRelays.clear(); | 309 | if (!LooksLikeRelay(rvRelay)) |
| 289 | vBtfMeetingRelays.push_back(rvRelay); | 310 | { |
| 311 | // A malformed pin must not replace the seed list: with the pin | ||
| 312 | // set, no discovered relay can ever mask the typo, and the pool | ||
| 313 | // would publish a garbage (or no) meeting node forever. | ||
| 314 | fprintf(stderr, "Ignoring /rvrelay=%s: expected host:port\n", | ||
| 315 | rvRelay.c_str()); | ||
| 316 | } | ||
| 317 | else | ||
| 318 | { | ||
| 319 | vBtfMeetingRelays.clear(); | ||
| 320 | vBtfMeetingRelays.push_back(rvRelay); | ||
| 321 | fBtfRelayPinned = true; | ||
| 322 | } | ||
| 290 | } | 323 | } |
| 291 | 324 | ||
| 292 | // net.cpp has described nListenPort as "tunable via /port" since it was | 325 | // net.cpp has described nListenPort as "tunable via /port" since it was |
| @@ -747,6 +780,31 @@ int main(int argc, char* argv[]) | |||
| 747 | 780 | ||
| 748 | ReacceptWalletTransactions(); | 781 | ReacceptWalletTransactions(); |
| 749 | 782 | ||
| 783 | // /dumpaddresses=N:FILE -- generate N fresh wallet keys and write their | ||
| 784 | // addresses (one per line) to FILE, then exit. Keys stay in this wallet; | ||
| 785 | // the file alone is enough for a miner elsewhere to rotate payout | ||
| 786 | // addresses via /payoutfile. (No HD/xpub exists in this wallet format.) | ||
| 787 | string dumpSpec = argval2(argc, argv, "/dumpaddresses", "-dumpaddresses"); | ||
| 788 | if (!dumpSpec.empty()) | ||
| 789 | { | ||
| 790 | size_t colon = dumpSpec.rfind(':'); | ||
| 791 | if (colon == string::npos) { fprintf(stderr, "usage: /dumpaddresses=N:FILE\n"); return 1; } | ||
| 792 | int n = atoi(dumpSpec.substr(0, colon).c_str()); | ||
| 793 | string file = dumpSpec.substr(colon + 1); | ||
| 794 | FILE* f = fopen(file.c_str(), "w"); | ||
| 795 | if (!f) { fprintf(stderr, "cannot open %s\n", file.c_str()); return 1; } | ||
| 796 | for (int i = 0; i < n; i++) | ||
| 797 | { | ||
| 798 | CKey key; | ||
| 799 | key.MakeNewKey(); | ||
| 800 | if (!AddKey(key)) { fclose(f); fprintf(stderr, "AddKey failed at %d\n", i); return 1; } | ||
| 801 | fprintf(f, "%s\n", PubKeyToAddress(key.GetPubKey()).c_str()); | ||
| 802 | } | ||
| 803 | fclose(f); | ||
| 804 | printf("wrote %d fresh wallet addresses to %s\n", n, file.c_str()); | ||
| 805 | return 0; | ||
| 806 | } | ||
| 807 | |||
| 750 | if (!StartNode(strErrors)) | 808 | if (!StartNode(strErrors)) |
| 751 | { | 809 | { |
| 752 | fprintf(stderr,"StartNode: %s\n",strErrors.c_str()); | 810 | fprintf(stderr,"StartNode: %s\n",strErrors.c_str()); |