mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 11:29:23 +00:00
Print merge mining status
This commit is contained in:
parent
4bc0b559cb
commit
9cd9055913
9 changed files with 72 additions and 1 deletions
|
@ -211,6 +211,9 @@ static void do_status(p2pool *m_pool, const char * /* args */)
|
||||||
#ifdef WITH_RANDOMX
|
#ifdef WITH_RANDOMX
|
||||||
m_pool->print_miner_status();
|
m_pool->print_miner_status();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
m_pool->print_merge_mining_status();
|
||||||
|
|
||||||
bkg_jobs_tracker.print_status();
|
bkg_jobs_tracker.print_status();
|
||||||
|
|
||||||
if (p2p) {
|
if (p2p) {
|
||||||
|
|
|
@ -39,6 +39,8 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] virtual bool get_params(ChainParameters& out_params) const = 0;
|
[[nodiscard]] virtual bool get_params(ChainParameters& out_params) const = 0;
|
||||||
virtual void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) = 0;
|
virtual void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) = 0;
|
||||||
|
|
||||||
|
virtual void print_status() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace p2pool
|
} // namespace p2pool
|
||||||
|
|
|
@ -317,6 +317,17 @@ void MergeMiningClientJSON_RPC::submit_solution(const BlockTemplate* /*block_tpl
|
||||||
}, &m_loop);
|
}, &m_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MergeMiningClientJSON_RPC::print_status() const
|
||||||
|
{
|
||||||
|
ReadLock lock(m_lock);
|
||||||
|
|
||||||
|
LOGINFO(0, "status" <<
|
||||||
|
"\nHost = " << m_host << ':' << m_port <<
|
||||||
|
"\nWallet = " << m_auxWallet <<
|
||||||
|
"\nDifficulty = " << m_chainParams.aux_diff
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bool MergeMiningClientJSON_RPC::get_params(ChainParameters& out_params) const
|
bool MergeMiningClientJSON_RPC::get_params(ChainParameters& out_params) const
|
||||||
{
|
{
|
||||||
ReadLock lock(m_lock);
|
ReadLock lock(m_lock);
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
bool get_params(ChainParameters& out_params) const override;
|
bool get_params(ChainParameters& out_params) const override;
|
||||||
void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
|
void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
|
||||||
|
|
||||||
|
void print_status() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void loop(void* data);
|
static void loop(void* data);
|
||||||
|
|
||||||
|
|
|
@ -285,6 +285,45 @@ void MergeMiningClientTari::submit_solution(const BlockTemplate* block_tpl, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct TariAmount
|
||||||
|
{
|
||||||
|
explicit FORCEINLINE TariAmount(uint64_t data) : m_data(data) {}
|
||||||
|
|
||||||
|
uint64_t m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct log::Stream::Entry<TariAmount>
|
||||||
|
{
|
||||||
|
static NOINLINE void put(TariAmount value, Stream* wrapper)
|
||||||
|
{
|
||||||
|
constexpr uint64_t denomination = 1000000ULL;
|
||||||
|
|
||||||
|
const int w = wrapper->getNumberWidth();
|
||||||
|
|
||||||
|
wrapper->setNumberWidth(1);
|
||||||
|
*wrapper << value.m_data / denomination << '.';
|
||||||
|
|
||||||
|
wrapper->setNumberWidth(6);
|
||||||
|
*wrapper << value.m_data % denomination << " Minotari";
|
||||||
|
|
||||||
|
wrapper->setNumberWidth(w);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void MergeMiningClientTari::print_status() const
|
||||||
|
{
|
||||||
|
ReadLock lock(m_chainParamsLock);
|
||||||
|
|
||||||
|
LOGINFO(0, "status" <<
|
||||||
|
"\nHost = " << m_hostStr <<
|
||||||
|
"\nWallet = " << m_auxWallet <<
|
||||||
|
"\nHeight = " << m_tariJobParams.height <<
|
||||||
|
"\nDifficulty = " << m_tariJobParams.diff <<
|
||||||
|
"\nReward = " << TariAmount(m_tariJobParams.reward) <<
|
||||||
|
"\nFees = " << TariAmount(m_tariJobParams.fees)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void MergeMiningClientTari::run_wrapper(void* arg)
|
void MergeMiningClientTari::run_wrapper(void* arg)
|
||||||
{
|
{
|
||||||
reinterpret_cast<MergeMiningClientTari*>(arg)->run();
|
reinterpret_cast<MergeMiningClientTari*>(arg)->run();
|
||||||
|
|
|
@ -30,10 +30,12 @@ public:
|
||||||
MergeMiningClientTari(p2pool* pool, std::string host, const std::string& wallet);
|
MergeMiningClientTari(p2pool* pool, std::string host, const std::string& wallet);
|
||||||
~MergeMiningClientTari() override;
|
~MergeMiningClientTari() override;
|
||||||
|
|
||||||
|
static constexpr char TARI_PREFIX[] = "tari://";
|
||||||
|
|
||||||
bool get_params(ChainParameters& out_params) const override;
|
bool get_params(ChainParameters& out_params) const override;
|
||||||
void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
|
void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
|
||||||
|
|
||||||
static constexpr char TARI_PREFIX[] = "tari://";
|
void print_status() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable uv_rwlock_t m_chainParamsLock;
|
mutable uv_rwlock_t m_chainParamsLock;
|
||||||
|
|
|
@ -311,6 +311,15 @@ void p2pool::print_miner_status()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void p2pool::print_merge_mining_status() const
|
||||||
|
{
|
||||||
|
ReadLock lock(m_mergeMiningClientsLock);
|
||||||
|
|
||||||
|
for (IMergeMiningClient* client : m_mergeMiningClients) {
|
||||||
|
client->print_status();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void p2pool::handle_tx(TxMempoolData& tx)
|
void p2pool::handle_tx(TxMempoolData& tx)
|
||||||
{
|
{
|
||||||
if (!tx.weight || !tx.fee) {
|
if (!tx.weight || !tx.fee) {
|
||||||
|
|
|
@ -80,6 +80,8 @@ public:
|
||||||
void print_miner_status();
|
void print_miner_status();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void print_merge_mining_status() const;
|
||||||
|
|
||||||
virtual void handle_tx(TxMempoolData& tx) override;
|
virtual void handle_tx(TxMempoolData& tx) override;
|
||||||
virtual void handle_miner_data(MinerData& data) override;
|
virtual void handle_miner_data(MinerData& data) override;
|
||||||
virtual void handle_chain_main(ChainMain& data, const char* extra) override;
|
virtual void handle_chain_main(ChainMain& data, const char* extra) override;
|
||||||
|
|
|
@ -2189,6 +2189,7 @@ void SideChain::prune_old_blocks()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pool->print_hosts();
|
m_pool->print_hosts();
|
||||||
|
m_pool->print_merge_mining_status();
|
||||||
bkg_jobs_tracker.print_status();
|
bkg_jobs_tracker.print_status();
|
||||||
m_pool->stop();
|
m_pool->stop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue