_XxFedexX_ 1 year ago
parent 71744611e9
commit f27163dabb

6
.gitmodules vendored

@ -1,9 +1,9 @@
[submodule "tests/googletest"]
path = tests/googletest
url = https://github.com/google/googletest
[submodule "external/src/RandomX"]
path = external/src/RandomX
url = https://github.com/SChernykh/RandomX
[submodule "external/src/RandomWOW"]
path = external/src/RandomWOW
url = https://git.wownero.com/wownero/RandomWOW
[submodule "external/src/rapidjson"]
path = external/src/rapidjson
url = https://github.com/SChernykh/rapidjson

@ -3,7 +3,7 @@ project(p2pool)
option(STATIC_BINARY "Build static binary" OFF)
option(STATIC_LIBS "Link libuv and libzmq statically" OFF)
option(WITH_RANDOMX "Include the RandomX library in the build. If this is turned off, p2pool will rely on monerod for verifying RandomX hashes" ON)
option(WITH_RANDOMX "Include the RandomX library in the build. If this is turned off, p2pool will rely on wownerod for verifying RandomX hashes" ON)
option(DEV_TEST_SYNC "[Developer only] Sync test, stop p2pool after sync is complete" OFF)
@ -13,7 +13,7 @@ set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT p
if (WITH_RANDOMX)
add_definitions(-DWITH_RANDOMX)
add_subdirectory(external/src/RandomX)
add_subdirectory(external/src/RandomWOW)
set(LIBS randomx)
endif()
@ -110,7 +110,7 @@ include_directories(${UV_INCLUDE_DIR})
include_directories(external/src/cppzmq)
include_directories(${ZMQ_INCLUDE_DIR})
if (WITH_RANDOMX)
include_directories(external/src/RandomX/src)
include_directories(external/src/RandomWOW/src)
endif()
include_directories(external/src/rapidjson/include)
include_directories(external/src/robin-hood-hashing/src/include)

@ -5,6 +5,6 @@
../external/src/cppzmq/
../external/src/libzmq/include/
../external/src/curl/include
../external/src/RandomX/src/
../external/src/RandomWOW/src/
../external/src/rapidjson/include
../external/src/robin-hood-hashing/src/include

@ -36,97 +36,28 @@
#define MONERO_DEFAULT_LOG_CATEGORY "blockchain.hardforks"
const hardfork_t mainnet_hard_forks[] = {
// version 1 from the start of the blockchain
{ 1, 1, 0, 1341378000 },
// version 2 starts from block 1009827, which is on or around the 20th of March, 2016. Fork time finalised on 2015-09-20. No fork voting occurs for the v2 fork.
{ 2, 1009827, 0, 1442763710 },
// version 3 starts from block 1141317, which is on or around the 24th of September, 2016. Fork time finalised on 2016-03-21.
{ 3, 1141317, 0, 1458558528 },
// version 4 starts from block 1220516, which is on or around the 5th of January, 2017. Fork time finalised on 2016-09-18.
{ 4, 1220516, 0, 1483574400 },
// version 5 starts from block 1288616, which is on or around the 15th of April, 2017. Fork time finalised on 2017-03-14.
{ 5, 1288616, 0, 1489520158 },
// version 6 starts from block 1400000, which is on or around the 16th of September, 2017. Fork time finalised on 2017-08-18.
{ 6, 1400000, 0, 1503046577 },
// version 7 starts from block 1546000, which is on or around the 6th of April, 2018. Fork time finalised on 2018-03-17.
{ 7, 1546000, 0, 1521303150 },
// version 8 starts from block 1685555, which is on or around the 18th of October, 2018. Fork time finalised on 2018-09-02.
{ 8, 1685555, 0, 1535889547 },
// version 9 starts from block 1686275, which is on or around the 19th of October, 2018. Fork time finalised on 2018-09-02.
{ 9, 1686275, 0, 1535889548 },
// version 10 starts from block 1788000, which is on or around the 9th of March, 2019. Fork time finalised on 2019-02-10.
{ 10, 1788000, 0, 1549792439 },
// version 11 starts from block 1788720, which is on or around the 10th of March, 2019. Fork time finalised on 2019-02-15.
{ 11, 1788720, 0, 1550225678 },
// version 12 starts from block 1978433, which is on or around the 30th of November, 2019. Fork time finalised on 2019-10-18.
{ 12, 1978433, 0, 1571419280 },
{ 13, 2210000, 0, 1598180817 },
{ 14, 2210720, 0, 1598180818 },
{ 15, 2688888, 0, 1656629117 },
{ 16, 2689608, 0, 1656629118 },
{ 7, 1, 0, 1519605000 },
{ 8, 6969, 0, 1524214739 },
{ 9, 53666, 0, 1538689773 },
{ 10, 63469, 0, 1541700352 },
{ 11, 81769, 0, 1549238400 },
{ 12, 82069, 0, 1549318761 },
{ 13, 114969, 0, 1559292691 },
{ 14, 115257, 0, 1559292774 },
{ 15, 160777, 0, 1573280497 },
{ 16, 253999, 0, 1600576508 },
{ 17, 254287, 0, 1600576524 },
{ 18, 331170, 0, 1623245591 },
{ 19, 331458, 0, 1624793373 },
};
const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]);
const uint64_t mainnet_hard_fork_version_1_till = 1009826;
const uint64_t mainnet_hard_fork_version_1_till = 0;
const hardfork_t testnet_hard_forks[] = {
// version 1 from the start of the blockchain
{ 1, 1, 0, 1341378000 },
// version 2 starts from block 624634, which is on or around the 23rd of November, 2015. Fork time finalised on 2015-11-20. No fork voting occurs for the v2 fork.
{ 2, 624634, 0, 1445355000 },
// versions 3-5 were passed in rapid succession from September 18th, 2016
{ 3, 800500, 0, 1472415034 },
{ 4, 801219, 0, 1472415035 },
{ 5, 802660, 0, 1472415036 + 86400*180 }, // add 5 months on testnet to shut the update warning up since there's a large gap to v6
{ 6, 971400, 0, 1501709789 },
{ 7, 1057027, 0, 1512211236 },
{ 8, 1057058, 0, 1533211200 },
{ 9, 1057778, 0, 1533297600 },
{ 10, 1154318, 0, 1550153694 },
{ 11, 1155038, 0, 1550225678 },
{ 12, 1308737, 0, 1569582000 },
{ 13, 1543939, 0, 1599069376 },
{ 14, 1544659, 0, 1599069377 },
{ 15, 1982800, 0, 1652727000 },
{ 16, 1983520, 0, 1652813400 },
};
const size_t num_testnet_hard_forks = sizeof(testnet_hard_forks) / sizeof(testnet_hard_forks[0]);
const uint64_t testnet_hard_fork_version_1_till = 624633;
const uint64_t testnet_hard_fork_version_1_till = 0;
const hardfork_t stagenet_hard_forks[] = {
// version 1 from the start of the blockchain
{ 1, 1, 0, 1341378000 },
// versions 2-7 in rapid succession from March 13th, 2018
{ 2, 32000, 0, 1521000000 },
{ 3, 33000, 0, 1521120000 },
{ 4, 34000, 0, 1521240000 },
{ 5, 35000, 0, 1521360000 },
{ 6, 36000, 0, 1521480000 },
{ 7, 37000, 0, 1521600000 },
{ 8, 176456, 0, 1537821770 },
{ 9, 177176, 0, 1537821771 },
{ 10, 269000, 0, 1550153694 },
{ 11, 269720, 0, 1550225678 },
{ 12, 454721, 0, 1571419280 },
{ 13, 675405, 0, 1598180817 },
{ 14, 676125, 0, 1598180818 },
{ 15, 1151000, 0, 1656629117 },
{ 16, 1151720, 0, 1656629118 },
};
const size_t num_stagenet_hard_forks = sizeof(stagenet_hard_forks) / sizeof(stagenet_hard_forks[0]);

@ -92,9 +92,9 @@
namespace p2pool {
constexpr size_t HASH_SIZE = 32;
constexpr uint8_t HARDFORK_VIEW_TAGS_VERSION = 15;
constexpr uint8_t HARDFORK_SUPPORTED_VERSION = 16;
constexpr uint8_t MINER_REWARD_UNLOCK_TIME = 60;
constexpr uint8_t HARDFORK_VIEW_TAGS_VERSION = 20;
constexpr uint8_t HARDFORK_SUPPORTED_VERSION = 20;
constexpr uint16_t MINER_REWARD_UNLOCK_TIME = 288;
constexpr uint8_t NONCE_SIZE = 4;
constexpr uint8_t EXTRA_NONCE_SIZE = 4;
constexpr uint8_t EXTRA_NONCE_MAX_SIZE = EXTRA_NONCE_SIZE + 10;

@ -27,13 +27,13 @@ void p2pool_usage()
printf("P2Pool %s\n"
"\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"
"--host IP address of your Wownero node, default is 127.0.0.1\n"
"--rpc-port wownerod RPC API port number, default is 34568\n"
"--zmq-port wownerod ZMQ pub port number, default is 34569 (same port as in wownerod'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"
"--light-mode Don't allocate RandomWOW dataset, saves 2GB of RAM\n"
"--loglevel Verbosity of the log, integer number between 0 and %d\n"
"--config Name of the p2pool config file\n"
"--data-api Path to the p2pool JSON data (use it in tandem with an external web-server)\n"
@ -41,19 +41,19 @@ void p2pool_usage()
"--stratum-api An alias for --local-api\n"
"--no-cache Disable p2pool.cache\n"
"--no-color Disable colors in console output\n"
"--no-randomx Disable internal RandomX hasher: p2pool will use RPC calls to monerod to check PoW hashes\n"
"--no-randomx Disable internal RandomX hasher: p2pool will use RPC calls to wownerod to check PoW hashes\n"
"--out-peers N Maximum number of outgoing connections for p2p server (any value between 10 and 450)\n"
"--in-peers N Maximum number of incoming connections for p2p server (any value between 10 and 450)\n"
"--start-mining N Start built-in miner using N threads (any value between 1 and 64)\n"
"--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from %d to %d\n"
"--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum\n"
"--rpc-login Specify username[:password] required for Monero RPC server\n"
"--rpc-login Specify username[:password] required for Wownero RPC server\n"
"--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections\n"
"--no-dns disable DNS queries, use only IP addresses to connect to peers (seed node DNS will be unavailable too)\n"
"--p2p-external-port port number that your router uses for mapping to your local p2p port. Use it if you are behind a NAT and still want to accept incoming connections\n"
"--help Show this help message\n\n"
"Example command line:\n\n"
"%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",
"%s --host 127.0.0.1 --rpc-port 34568 --zmq-port 34569 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n",
p2pool::VERSION,
p2pool::log::MAX_GLOBAL_LOG_LEVEL,
p2pool::DEFAULT_P2P_PORT,

@ -327,9 +327,9 @@ void P2PServer::update_peer_connections()
uint32_t N = m_maxOutgoingPeers;
// Special case: when we can't find p2pool peers, scan through monerod peers (try 25 peers at a time)
// Special case: when we can't find p2pool peers, scan through wownerod peers (try 25 peers at a time)
if (!has_good_peers && !m_peerListMonero.empty()) {
LOGINFO(3, "Scanning monerod peers, " << m_peerListMonero.size() << " left");
LOGINFO(3, "Scanning wownerod peers, " << m_peerListMonero.size() << " left");
for (uint32_t i = 0; (i < 25) && !m_peerListMonero.empty(); ++i) {
peer_list.push_back(m_peerListMonero.back());
m_peerListMonero.pop_back();
@ -353,7 +353,7 @@ void P2PServer::update_peer_connections()
}
if (!has_good_peers && ((m_timerCounter % 10) == 0)) {
LOGERR(1, "no connections to other p2pool nodes, check your monerod/p2pool/network/firewall setup!!!");
LOGERR(1, "no connections to other p2pool nodes, check your wownerod/p2pool/network/firewall setup!!!");
load_peer_list();
if (m_peerListMonero.empty()) {
load_monerod_peer_list();
@ -667,7 +667,7 @@ void P2PServer::load_monerod_peer_list()
// Put recently active peers last in the list (it will be scanned backwards)
std::sort(m_peerListMonero.begin(), m_peerListMonero.end(), [](const Peer& a, const Peer& b) { return a.m_lastSeen < b.m_lastSeen; });
LOGINFO(4, "monerod peer list loaded (" << m_peerListMonero.size() << " peers)");
LOGINFO(4, "wownerod peer list loaded (" << m_peerListMonero.size() << " peers)");
},
[](const char* data, size_t size)
{
@ -1151,7 +1151,7 @@ void P2PServer::check_zmq()
if (cur_time >= last_active + 300) {
const uint64_t dt = static_cast<uint64_t>(cur_time - last_active);
LOGERR(1, "no ZMQ messages received from monerod in the last " << dt << " seconds, check your monerod/p2pool/network/firewall setup!!!");
LOGERR(1, "no ZMQ messages received from wownerod in the last " << dt << " seconds, check your wownerod/p2pool/network/firewall setup!!!");
m_pool->restart_zmq();
}
}
@ -2006,7 +2006,7 @@ bool P2PServer::P2PClient::on_block_broadcast(const uint8_t* buf, uint32_t size,
}
else if (peer_height > our_height) {
if (peer_height >= our_height + 2) {
LOGWARN(3, "peer " << static_cast<char*>(m_addrString) << " is ahead on mainchain (height " << peer_height << ", your height " << our_height << "). Is your monerod stuck or lagging?");
LOGWARN(3, "peer " << static_cast<char*>(m_addrString) << " is ahead on mainchain (height " << peer_height << ", your height " << our_height << "). Is your wownerod stuck or lagging?");
}
}
else {

@ -28,8 +28,8 @@ class BlockCache;
static constexpr size_t P2P_BUF_SIZE = 128 * 1024;
static constexpr size_t PEER_LIST_RESPONSE_MAX_PEERS = 16;
static constexpr int DEFAULT_P2P_PORT = 37889;
static constexpr int DEFAULT_P2P_PORT_MINI = 37888;
static constexpr int DEFAULT_P2P_PORT = 47889;
static constexpr int DEFAULT_P2P_PORT_MINI = 47888;
static constexpr uint32_t PROTOCOL_VERSION_1_0 = 0x00010000UL;
static constexpr uint32_t PROTOCOL_VERSION_1_1 = 0x00010001UL;

@ -329,7 +329,7 @@ void p2pool::handle_miner_data(MinerData& data)
for (uint64_t h = data.height; h && (h + BLOCK_HEADERS_REQUIRED > data.height); --h) {
auto it = m_mainchainByHeight.find(h);
if ((it == m_mainchainByHeight.end()) || it->second.difficulty.empty()) {
LOGWARN(3, "Mainchain data for height " << h << " is missing, requesting it from monerod again");
LOGWARN(3, "Mainchain data for height " << h << " is missing, requesting it from wownerod again");
missing_heights.push_back(h);
}
}
@ -916,7 +916,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size)
}
if (info.busy_syncing || !info.synchronized) {
LOGINFO(1, "monerod is " << (info.busy_syncing ? "busy syncing" : "not synchronized") << ", trying again in 1 second");
LOGINFO(1, "wownerod is " << (info.busy_syncing ? "busy syncing" : "not synchronized") << ", trying again in 1 second");
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
get_info();
return;
@ -931,7 +931,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size)
const NetworkType sidechain_network = m_sideChain->network_type();
if (monero_network != sidechain_network) {
LOGERR(1, "monerod is on " << monero_network << ", but you're mining to a " << sidechain_network << " sidechain");
LOGERR(1, "wownerod is on " << monero_network << ", but you're mining to a " << sidechain_network << " sidechain");
PANIC_STOP();
}
@ -993,15 +993,15 @@ void p2pool::parse_get_version_rpc(const char* data, size_t size)
}
constexpr uint64_t major = 3;
constexpr uint64_t minor = 10;
constexpr uint64_t required = (major << 16) | minor;
constexpr uint64_t minor = 11;
constexpr uint64_t required = (major << 20) | minor;
if (version < required) {
const uint64_t version_hi = version >> 16;
const uint64_t version_hi = version >> 20;
const uint64_t version_lo = version & 65535;
const uint64_t required_version_hi = required >> 16;
const uint64_t required_version_hi = required >> 20;
const uint64_t required_version_lo = required & 65535;
LOGERR(1, "monerod RPC v" << version_hi << '.' << version_lo << " is incompatible, update to RPC >= v" << required_version_hi << '.' << required_version_lo << " (Monero v0.18.0.0 or newer)");
LOGERR(1, "wownerod RPC v" << version_hi << '.' << version_lo << " is incompatible, update to RPC >= v" << required_version_hi << '.' << required_version_lo << " (Wownero v0.11.0.0 or newer)");
PANIC_STOP();
}

@ -28,8 +28,8 @@ struct Params
bool valid() const;
std::string m_host = "127.0.0.1";
uint32_t m_rpcPort = 18081;
uint32_t m_zmqPort = 18083;
uint32_t m_rpcPort = 34568;
uint32_t m_zmqPort = 34569;
bool m_lightMode = false;
Wallet m_wallet{ nullptr };
std::string m_stratumAddresses;

@ -47,20 +47,19 @@ static constexpr size_t UNCLE_BLOCK_DEPTH = 3;
static_assert(1 <= UNCLE_BLOCK_DEPTH && UNCLE_BLOCK_DEPTH <= 10, "Invalid UNCLE_BLOCK_DEPTH");
static constexpr uint64_t MONERO_BLOCK_TIME = 120;
static constexpr uint64_t MONERO_BLOCK_TIME = 300;
namespace p2pool {
static constexpr uint8_t default_consensus_id[HASH_SIZE] = { 34,175,126,231,181,11,104,146,227,153,218,107,44,108,68,39,178,81,4,212,169,4,142,0,177,110,157,240,68,7,249,24 };
static constexpr uint8_t mini_consensus_id[HASH_SIZE] = { 57,130,201,26,149,174,199,250,66,80,189,18,108,216,194,220,136,23,63,24,64,113,221,44,219,86,39,163,53,24,126,196 };
static constexpr uint8_t default_consensus_id[HASH_SIZE] = { 44,140,4,232,212,21,204,246,227,153,218,107,44,108,68,39,178,81,4,212,169,4,142,0,177,110,157,240,68,7,249,24 };
static constexpr uint8_t mini_consensus_id[HASH_SIZE] = { 67,238,187,36,45,2,14,156,66,80,189,18,108,216,194,220,136,23,63,24,64,113,221,44,219,86,39,163,53,24,126,196 };
NetworkType SideChain::s_networkType = NetworkType::Invalid;
SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name)
: m_pool(pool)
, m_chainTip{ nullptr }
, m_seenWalletsLastPruneTime(0)
, m_poolName(pool_name ? pool_name : "default")
, m_poolName(pool_name ? pool_name : "wow")
, m_targetBlockTime(10)
, m_minDifficulty(MIN_DIFFICULTY, 0)
, m_chainWindowSize(2160)
@ -562,7 +561,7 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
// Check if it has the correct parent and difficulty to go right to monerod for checking
MinerData miner_data = m_pool->miner_data();
if ((block.m_prevId == miner_data.prev_id) && miner_data.difficulty.check_pow(pow_hash)) {
LOGINFO(0, log::LightGreen() << "add_external_block: block " << block.m_sidechainId << " has enough PoW for Monero network, submitting it");
LOGINFO(0, log::LightGreen() << "add_external_block: block " << block.m_sidechainId << " has enough PoW for Wownero network, submitting it");
m_pool->submit_block_async(block.serialize_mainchain_data());
}
else {
@ -571,7 +570,7 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
LOGWARN(3, "add_external_block: couldn't get mainchain difficulty for height = " << block.m_txinGenHeight);
}
else if (diff.check_pow(pow_hash)) {
LOGINFO(0, log::LightGreen() << "add_external_block: block " << block.m_sidechainId << " has enough PoW for Monero height " << block.m_txinGenHeight << ", submitting it");
LOGINFO(0, log::LightGreen() << "add_external_block: block " << block.m_sidechainId << " has enough PoW for Wownero height " << block.m_txinGenHeight << ", submitting it");
m_pool->submit_block_async(block.serialize_mainchain_data());
}
}

@ -83,7 +83,7 @@ include_directories(../external/src/cryptonote)
include_directories(${UV_INCLUDE_DIR})
include_directories(../external/src/cppzmq)
include_directories(${ZMQ_INCLUDE_DIR})
include_directories(../external/src/RandomX/src)
include_directories(../external/src/RandomWOW/src)
include_directories(../external/src/rapidjson/include)
include_directories(../external/src/robin-hood-hashing/src/include)
include_directories(src)

Loading…
Cancel
Save