2021-08-22 10:20:59 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
|
|
|
* Copyright (c) 2021 SChernykh <https://github.com/SChernykh>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h"
|
2021-10-01 13:21:32 +00:00
|
|
|
#include "crypto.h"
|
2021-08-22 10:20:59 +00:00
|
|
|
#include "p2pool.h"
|
2021-09-18 08:03:06 +00:00
|
|
|
#include "stratum_server.h"
|
|
|
|
#include "p2p_server.h"
|
2021-08-22 10:20:59 +00:00
|
|
|
|
|
|
|
static void usage()
|
|
|
|
{
|
|
|
|
printf(
|
|
|
|
"\nUsage:\n\n" \
|
|
|
|
"--wallet Wallet address to mine to. Subaddresses and integrated addresses are not supported!\n"
|
|
|
|
"--host IP address of your Monero node, default is 127.0.0.1\n"
|
|
|
|
"--rpc-port monerod RPC API port number, default is 18081\n"
|
|
|
|
"--zmq-port monerod ZMQ pub port number, default is 18083 (same port as in monerod's \"--zmq-pub\" command line parameter)\n"
|
|
|
|
"--stratum Comma-separated list of IP:port for stratum server to listen on\n"
|
|
|
|
"--p2p Comma-separated list of IP:port for p2p server to listen on\n"
|
|
|
|
"--addpeers Comma-separated list of IP:port of other p2pool nodes to connect to\n"
|
|
|
|
"--light-mode Don't allocate RandomX dataset, saves 2GB of RAM\n"
|
|
|
|
"--loglevel Verbosity of the log, integer number between 0 and 5\n"
|
|
|
|
"--config Name of the p2pool config file\n"
|
2021-09-01 11:49:58 +00:00
|
|
|
"--data-api Path to the p2pool JSON data (use it in tandem with an external web-server)\n"
|
2021-08-22 10:20:59 +00:00
|
|
|
"--help Show this help message\n\n"
|
|
|
|
"Example command line:\n\n"
|
2021-09-18 08:03:06 +00:00
|
|
|
"%s --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n",
|
2021-08-22 10:20:59 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
"p2pool.exe"
|
|
|
|
#else
|
|
|
|
"./p2pool"
|
|
|
|
#endif
|
2021-09-18 08:03:06 +00:00
|
|
|
, p2pool::DEFAULT_STRATUM_PORT
|
|
|
|
, p2pool::DEFAULT_P2P_PORT
|
2021-08-22 10:20:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-08-26 21:27:05 +00:00
|
|
|
void memory_tracking_start();
|
|
|
|
void memory_tracking_stop();
|
|
|
|
|
2021-08-22 10:20:59 +00:00
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
if (argc == 1) {
|
|
|
|
usage();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 1; i < argc; ++i) {
|
|
|
|
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "/help") || !strcmp(argv[i], "-h") || !strcmp(argv[i], "/h")) {
|
|
|
|
usage();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-26 21:27:05 +00:00
|
|
|
int result;
|
|
|
|
|
|
|
|
memory_tracking_start();
|
2021-10-01 13:21:32 +00:00
|
|
|
|
|
|
|
p2pool::init_crypto_cache();
|
2021-08-26 21:27:05 +00:00
|
|
|
{
|
|
|
|
p2pool::p2pool pool(argc, argv);
|
|
|
|
result = pool.run();
|
|
|
|
}
|
2021-10-01 13:21:32 +00:00
|
|
|
p2pool::destroy_crypto_cache();
|
|
|
|
|
2021-08-26 21:27:05 +00:00
|
|
|
memory_tracking_stop();
|
|
|
|
|
|
|
|
return result;
|
2021-08-22 10:20:59 +00:00
|
|
|
}
|