ZeroMQ support for solo mining
Gets new blocks from daemon immediately without polling, saving ~0.5 seconds on average when daemon gets new block from the network. Also saves some CPU cycles because it doesn't need to poll daemon every second. Testing: add "daemon-zmq-port": 28083 to xmrig's pool config in config.json and run ./monerod --testnet --zmq-pub tcp://127.0.0.1:28083
This commit is contained in:
parent
93805cd167
commit
0842e6b9d2
12 changed files with 482 additions and 35 deletions
|
@ -137,9 +137,14 @@ void xmrig::Network::onActive(IStrategy *strategy, IClient *client)
|
|||
}
|
||||
# endif
|
||||
|
||||
char zmq_buf[32] = {};
|
||||
if (client->pool().zmq_port() >= 0) {
|
||||
snprintf(zmq_buf, sizeof(zmq_buf), " (ZMQ:%d)", client->pool().zmq_port());
|
||||
}
|
||||
|
||||
const char *tlsVersion = client->tlsVersion();
|
||||
LOG_INFO("%s " WHITE_BOLD("use %s ") CYAN_BOLD("%s:%d ") GREEN_BOLD("%s") " " BLACK_BOLD("%s"),
|
||||
Tags::network(), client->mode(), pool.host().data(), pool.port(), tlsVersion ? tlsVersion : "", client->ip().data());
|
||||
LOG_INFO("%s " WHITE_BOLD("use %s ") CYAN_BOLD("%s:%d%s ") GREEN_BOLD("%s") " " BLACK_BOLD("%s"),
|
||||
Tags::network(), client->mode(), pool.host().data(), pool.port(), zmq_buf, tlsVersion ? tlsVersion : "", client->ip().data());
|
||||
|
||||
const char *fingerprint = client->tlsFingerprint();
|
||||
if (fingerprint != nullptr) {
|
||||
|
@ -272,8 +277,13 @@ void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
|
|||
uint64_t diff = job.diff();;
|
||||
const char *scale = NetworkState::scaleDiff(diff);
|
||||
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), diff, scale, job.algorithm().shortName(), job.height());
|
||||
char zmq_buf[32] = {};
|
||||
if (client->pool().zmq_port() >= 0) {
|
||||
snprintf(zmq_buf, sizeof(zmq_buf), " (ZMQ:%d)", client->pool().zmq_port());
|
||||
}
|
||||
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d%s") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), zmq_buf, diff, scale, job.algorithm().shortName(), job.height());
|
||||
}
|
||||
|
||||
if (!donate && m_donate) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue