print_status: fixed next payout display

pull/5/head
SChernykh 3 years ago
parent 0009eba307
commit 63e442dffd

@ -52,7 +52,6 @@ BlockTemplate::BlockTemplate(p2pool* pool)
, m_timestamp(0)
, m_poolBlockTemplate(new PoolBlock())
, m_finalReward(0)
, m_nextPayout(0)
{
uv_rwlock_init_checked(&m_lock);
@ -123,7 +122,6 @@ BlockTemplate& BlockTemplate::operator=(const BlockTemplate& b)
m_txkeySec = b.m_txkeySec;
*m_poolBlockTemplate = *b.m_poolBlockTemplate;
m_finalReward = b.m_finalReward;
m_nextPayout = b.m_nextPayout;
m_minerTx.clear();
m_blockHeader.clear();
@ -417,13 +415,6 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, Wallet
}
m_finalReward = final_reward;
m_nextPayout = 0;
for (size_t i = 0, n = m_shares.size(); i < n; ++i) {
if (*m_shares[i].m_wallet == m_pool->params().m_wallet) {
m_nextPayout = m_rewards[i];
break;
}
}
if (!create_miner_tx(data, m_shares, max_reward_amounts_weight, false)) {
return;

@ -55,7 +55,6 @@ public:
void submit_sidechain_block(uint32_t template_id, uint32_t nonce, uint32_t extra_nonce);
FORCEINLINE uint64_t final_reward() const { return m_finalReward; }
FORCEINLINE uint64_t next_payout() const { return m_nextPayout; }
private:
p2pool* m_pool;
@ -97,7 +96,6 @@ private:
BlockTemplate* m_oldTemplates[4] = {};
uint64_t m_finalReward;
uint64_t m_nextPayout;
// Temp vectors, will be cleaned up after use and skipped in copy constructor/assignment operators
std::vector<uint8_t> m_minerTx;

@ -616,7 +616,19 @@ void SideChain::print_status()
}
const uint64_t block_reward = m_pool->block_template().final_reward();
const uint64_t next_payout = m_pool->block_template().next_payout();
uint64_t next_payout = 0;
if (m_chainTip) {
Wallet w = m_pool->params().m_wallet;
hash eph_public_key;
for (size_t i = 0, n = m_chainTip->m_outputs.size(); i < n; ++i) {
w.get_eph_public_key(m_chainTip->m_txkeySec, i, eph_public_key);
if (m_chainTip->m_outputs[i].m_ephPublicKey == eph_public_key) {
next_payout = m_chainTip->m_outputs[i].m_reward;
break;
}
}
}
uint64_t product[2];
product[0] = umul128(pool_hashrate, next_payout, &product[1]);

Loading…
Cancel
Save