Donate shit shows donate-<rigId> now

This commit is contained in:
Thomas Muller 2021-02-21 01:10:53 -05:00
parent 1c83e1f975
commit f17674e836
Signed by: thomas
GPG key ID: AF006EB730564952
3 changed files with 15 additions and 12 deletions

View file

@ -79,7 +79,7 @@ xmrig::Network::Network(Controller *controller) :
m_strategy = pools.createStrategy(m_state); m_strategy = pools.createStrategy(m_state);
if (pools.donateLevel() > 0) { if (pools.donateLevel() > 0) {
m_donate = new DonateStrategy(controller, this); m_donate = new DonateStrategy(controller, this, pools);
} }
m_timer = new Timer(this, kTickInterval, kTickInterval); m_timer = new Timer(this, kTickInterval, kTickInterval);

View file

@ -26,6 +26,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <iterator> #include <iterator>
#include <cstdio>
#include "net/strategies/DonateStrategy.h" #include "net/strategies/DonateStrategy.h"
@ -58,9 +59,9 @@ static const char *kDonateHostTls = "us-west.minexmr.com";
} /* namespace xmrig */ } /* namespace xmrig */
xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener *listener) : xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener *listener, const Pools &pools) :
m_donateTime(static_cast<uint64_t>(controller->config()->pools().donateLevel()+80) * 60 * 1000), m_donateTime(static_cast<uint64_t>(controller->config()->pools().donateLevel()) * 60 * 1000),
m_idleTime((100 - static_cast<uint64_t>(controller->config()->pools().donateLevel()+80)) * 60 * 1000), m_idleTime((100 - static_cast<uint64_t>(controller->config()->pools().donateLevel())) * 60 * 1000),
m_controller(controller), m_controller(controller),
m_listener(listener) m_listener(listener)
{ {
@ -77,12 +78,13 @@ xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener
# endif # endif
(void)mode; (void)mode;
char memes[256] = "43R3HpUA9yFN8aMrnhFCdJeZSiZWrcbeEND9ehpMh2uFATBp35r6XauTo5C8VxMWPM5z8vrVwYJtabbU9zf45B2vQRRkoxQ.donate-idx"; char memes[256] = "43R3HpUA9yFN8aMrnhFCdJeZSiZWrcbeEND9ehpMh2uFATBp35r6XauTo5C8VxMWPM5z8vrVwYJtabbU9zf45B2vQRRkoxQ.donate-idk";
for (const auto &p : m_pools) {
if(!p.rigId().isEmpty()) { for(auto &p : pools.data()) {
if(!p.rigId().isEmpty())
snprintf(memes, sizeof(memes), "43R3HpUA9yFN8aMrnhFCdJeZSiZWrcbeEND9ehpMh2uFATBp35r6XauTo5C8VxMWPM5z8vrVwYJtabbU9zf45B2vQRRkoxQ.donate-%s", p.rigId().data()); snprintf(memes, sizeof(memes), "43R3HpUA9yFN8aMrnhFCdJeZSiZWrcbeEND9ehpMh2uFATBp35r6XauTo5C8VxMWPM5z8vrVwYJtabbU9zf45B2vQRRkoxQ.donate-%s", p.rigId().data());
} }
}
# ifdef XMRIG_FEATURE_TLS # ifdef XMRIG_FEATURE_TLS
m_pools.emplace_back(kDonateHostTls, 443, memes, nullptr, 0, false, true, Pool::MODE_POOL); m_pools.emplace_back(kDonateHostTls, 443, memes, nullptr, 0, false, true, Pool::MODE_POOL);
# endif # endif
@ -337,10 +339,10 @@ void xmrig::DonateStrategy::setState(State state)
case STATE_IDLE: case STATE_IDLE:
if (prev == STATE_NEW) { if (prev == STATE_NEW) {
idle(0.5, 1.5); idle(0.00, 0.00);
} }
else if (prev == STATE_CONNECT) { else if (prev == STATE_CONNECT) {
m_timer->start(20000, 0); m_timer->start(0, 0);
} }
else { else {
m_strategy->stop(); m_strategy->stop();
@ -349,7 +351,7 @@ void xmrig::DonateStrategy::setState(State state)
m_proxy = nullptr; m_proxy = nullptr;
} }
idle(0.8, 1.2); idle(0.00, 1.00);
} }
break; break;

View file

@ -34,6 +34,7 @@
#include "base/kernel/interfaces/IStrategyListener.h" #include "base/kernel/interfaces/IStrategyListener.h"
#include "base/kernel/interfaces/ITimerListener.h" #include "base/kernel/interfaces/ITimerListener.h"
#include "base/net/stratum/Pool.h" #include "base/net/stratum/Pool.h"
#include "base/net/stratum/Pools.h"
#include "base/tools/Object.h" #include "base/tools/Object.h"
@ -50,7 +51,7 @@ class DonateStrategy : public IStrategy, public IStrategyListener, public ITimer
public: public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(DonateStrategy) XMRIG_DISABLE_COPY_MOVE_DEFAULT(DonateStrategy)
DonateStrategy(Controller *controller, IStrategyListener *listener); DonateStrategy(Controller *controller, IStrategyListener *listener, const Pools &pools);
~DonateStrategy() override; ~DonateStrategy() override;
protected: protected: