added donation state tracking, proper entering and exiting message, every 720 blocks on mainchain or 0.139%
This commit is contained in:
@@ -55,6 +55,7 @@ BlockTemplate::BlockTemplate(SideChain* sidechain, RandomX_Hasher_Base* hasher)
|
||||
, m_auxDifficulty{}
|
||||
, m_seedHash{}
|
||||
, m_timestamp(0)
|
||||
, m_lastWasDonation(false)
|
||||
, m_poolBlockTemplate(new PoolBlock())
|
||||
, m_finalReward(0)
|
||||
, m_minerTxKeccakState{}
|
||||
@@ -138,6 +139,7 @@ BlockTemplate& BlockTemplate::operator=(const BlockTemplate& b)
|
||||
m_auxDifficulty = b.m_auxDifficulty;
|
||||
m_seedHash = b.m_seedHash;
|
||||
m_timestamp = b.m_timestamp;
|
||||
m_lastWasDonation = b.m_lastWasDonation;
|
||||
*m_poolBlockTemplate = *b.m_poolBlockTemplate;
|
||||
m_finalReward = b.m_finalReward.load();
|
||||
|
||||
@@ -297,7 +299,12 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
}
|
||||
m_shares.clear();
|
||||
m_shares.emplace_back(total_weight, ¶ms->m_devWallet);
|
||||
LOGINFO(4, "Donation mode: entire block reward goes to dev wallet");
|
||||
LOGINFO(3, "Entering donation mode at height " << data.height << ": share reward is donated to developer");
|
||||
m_lastWasDonation = true;
|
||||
}
|
||||
else if (m_lastWasDonation) {
|
||||
LOGINFO(3, "Exiting donation mode at height " << data.height << ": resuming normal mining");
|
||||
m_lastWasDonation = false;
|
||||
}
|
||||
|
||||
// Pre-calculate outputs to speed up miner tx generation
|
||||
|
||||
@@ -109,6 +109,8 @@ private:
|
||||
|
||||
uint64_t m_timestamp;
|
||||
|
||||
bool m_lastWasDonation;
|
||||
|
||||
PoolBlock* m_poolBlockTemplate;
|
||||
|
||||
#ifdef P2POOL_UNIT_TESTS
|
||||
|
||||
Reference in New Issue
Block a user