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 bef8503..e941522 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp | |||
| @@ -117,6 +117,9 @@ static void PrintUsage() | |||
| 117 | printf("Mining mode:\n"); | 117 | printf("Mining mode:\n"); |
| 118 | printf(" /operator\n"); | 118 | printf(" /operator\n"); |
| 119 | printf(" /participant=POOL_BTF_ADDRESS\n"); | 119 | printf(" /participant=POOL_BTF_ADDRESS\n"); |
| 120 | printf(" /payoutaddr=BTF_ADDRESS (participant: pay shares to this address, no wallet needed)\n"); | ||
| 121 | printf(" /payoutfile=FILE (participant: rotate payout addresses from file)\n"); | ||
| 122 | printf(" /hashthreads=N (participant: mining threads, default cores-1)\n"); | ||
| 120 | printf(" /stratumbridge=POOL_BTF_ADDRESS\n"); | 123 | printf(" /stratumbridge=POOL_BTF_ADDRESS\n"); |
| 121 | printf(" /stratumbridgeport=N (default 3333; listen on 127.0.0.1)\n"); | 124 | printf(" /stratumbridgeport=N (default 3333; listen on 127.0.0.1)\n"); |
| 122 | printf(" /solomine\n"); | 125 | printf(" /solomine\n"); |
| @@ -207,7 +210,7 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 207 | if (!strProcLimit.empty()) | 210 | if (!strProcLimit.empty()) |
| 208 | { | 211 | { |
| 209 | int n = atoi(strProcLimit.c_str()); | 212 | int n = atoi(strProcLimit.c_str()); |
| 210 | unsigned int nCores = std::thread::hardware_concurrency(); | 213 | unsigned int nCores = AvailableCoreCount(); |
| 211 | if (n < 0) | 214 | if (n < 0) |
| 212 | fprintf(stderr, "Ignoring /genproclimit=%s: not a thread count\n", | 215 | fprintf(stderr, "Ignoring /genproclimit=%s: not a thread count\n", |
| 213 | strProcLimit.c_str()); | 216 | strProcLimit.c_str()); |
| @@ -233,6 +236,18 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 233 | fMineModeFromCommandLine = true; | 236 | fMineModeFromCommandLine = true; |
| 234 | } | 237 | } |
| 235 | 238 | ||
| 239 | string payoutAddr = argval2(argc, argv, "/payoutaddr", "-payoutaddr"); | ||
| 240 | if (!payoutAddr.empty()) | ||
| 241 | strPayoutAddress = payoutAddr; | ||
| 242 | |||
| 243 | string payoutFile = argval2(argc, argv, "/payoutfile", "-payoutfile"); | ||
| 244 | if (!payoutFile.empty()) | ||
| 245 | strPayoutFile = payoutFile; | ||
| 246 | |||
| 247 | string hashThreads = argval2(argc, argv, "/hashthreads", "-hashthreads"); | ||
| 248 | if (!hashThreads.empty()) | ||
| 249 | nHashThreads = atoi(hashThreads.c_str()); | ||
| 250 | |||
| 236 | if (arg(argc,argv,"/stratumbridge") || arg(argc,argv,"-stratumbridge")) | 251 | if (arg(argc,argv,"/stratumbridge") || arg(argc,argv,"-stratumbridge")) |
| 237 | { | 252 | { |
| 238 | fStratumBridge = true; | 253 | fStratumBridge = true; |
| @@ -259,6 +274,12 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 259 | if (!poolDash.empty()) | 274 | if (!poolDash.empty()) |
| 260 | strPoolDashboardUrl = poolDash; | 275 | strPoolDashboardUrl = poolDash; |
| 261 | 276 | ||
| 277 | if (arg(argc,argv,"/noannounce") || arg(argc,argv,"-noannounce")) | ||
| 278 | fPoolNoAnnounce = true; | ||
| 279 | |||
| 280 | if (arg(argc,argv,"/poolmineblind") || arg(argc,argv,"-poolmineblind")) | ||
| 281 | fPoolMineBlind = true; | ||
| 282 | |||
| 262 | string poolFee = argval2(argc, argv, "/poolfee", "-poolfee"); | 283 | string poolFee = argval2(argc, argv, "/poolfee", "-poolfee"); |
| 263 | if (!poolFee.empty()) | 284 | if (!poolFee.empty()) |
| 264 | dPoolFeePercent = atof(poolFee.c_str()); | 285 | dPoolFeePercent = atof(poolFee.c_str()); |
| @@ -278,8 +299,20 @@ static void ParseStartupArguments(int argc, char* argv[]) | |||
| 278 | string rvRelay = argval2(argc, argv, "/rvrelay", "-rvrelay"); | 299 | string rvRelay = argval2(argc, argv, "/rvrelay", "-rvrelay"); |
| 279 | if (!rvRelay.empty()) | 300 | if (!rvRelay.empty()) |
| 280 | { | 301 | { |
| 281 | vBtfMeetingRelays.clear(); | 302 | if (!LooksLikeRelay(rvRelay)) |
| 282 | vBtfMeetingRelays.push_back(rvRelay); | 303 | { |
| 304 | // A malformed pin must not replace the seed list: with the pin | ||
| 305 | // set, no discovered relay can ever mask the typo, and the pool | ||
| 306 | // would publish a garbage (or no) meeting node forever. | ||
| 307 | fprintf(stderr, "Ignoring /rvrelay=%s: expected host:port\n", | ||
| 308 | rvRelay.c_str()); | ||
| 309 | } | ||
| 310 | else | ||
| 311 | { | ||
| 312 | vBtfMeetingRelays.clear(); | ||
| 313 | vBtfMeetingRelays.push_back(rvRelay); | ||
| 314 | fBtfRelayPinned = true; | ||
| 315 | } | ||
| 283 | } | 316 | } |
| 284 | 317 | ||
| 285 | string announceRelay = argval2(argc, argv, "/announcerelay", "-announcerelay"); | 318 | string announceRelay = argval2(argc, argv, "/announcerelay", "-announcerelay"); |
| @@ -702,6 +735,31 @@ int main(int argc, char* argv[]) | |||
| 702 | 735 | ||
| 703 | ReacceptWalletTransactions(); | 736 | ReacceptWalletTransactions(); |
| 704 | 737 | ||
| 738 | // /dumpaddresses=N:FILE -- generate N fresh wallet keys and write their | ||
| 739 | // addresses (one per line) to FILE, then exit. Keys stay in this wallet; | ||
| 740 | // the file alone is enough for a miner elsewhere to rotate payout | ||
| 741 | // addresses via /payoutfile. (No HD/xpub exists in this wallet format.) | ||
| 742 | string dumpSpec = argval2(argc, argv, "/dumpaddresses", "-dumpaddresses"); | ||
| 743 | if (!dumpSpec.empty()) | ||
| 744 | { | ||
| 745 | size_t colon = dumpSpec.rfind(':'); | ||
| 746 | if (colon == string::npos) { fprintf(stderr, "usage: /dumpaddresses=N:FILE\n"); return 1; } | ||
| 747 | int n = atoi(dumpSpec.substr(0, colon).c_str()); | ||
| 748 | string file = dumpSpec.substr(colon + 1); | ||
| 749 | FILE* f = fopen(file.c_str(), "w"); | ||
| 750 | if (!f) { fprintf(stderr, "cannot open %s\n", file.c_str()); return 1; } | ||
| 751 | for (int i = 0; i < n; i++) | ||
| 752 | { | ||
| 753 | CKey key; | ||
| 754 | key.MakeNewKey(); | ||
| 755 | if (!AddKey(key)) { fclose(f); fprintf(stderr, "AddKey failed at %d\n", i); return 1; } | ||
| 756 | fprintf(f, "%s\n", PubKeyToAddress(key.GetPubKey()).c_str()); | ||
| 757 | } | ||
| 758 | fclose(f); | ||
| 759 | printf("wrote %d fresh wallet addresses to %s\n", n, file.c_str()); | ||
| 760 | return 0; | ||
| 761 | } | ||
| 762 | |||
| 705 | if (!StartNode(strErrors)) { fprintf(stderr,"StartNode: %s\n",strErrors.c_str()); return 1; } | 763 | if (!StartNode(strErrors)) { fprintf(stderr,"StartNode: %s\n",strErrors.c_str()); return 1; } |
| 706 | 764 | ||
| 707 | if (nMineMode == MINE_OPERATOR) { | 765 | if (nMineMode == MINE_OPERATOR) { |