Refactoring

- Skip calling time(nullptr) twice
- Use getter method for m_api instead of exposing it
- Moved api_udate_*() back to private since they're not used anywhere else
This commit is contained in:
SChernykh
2021-10-04 10:28:56 +02:00
parent a0a31b0f3b
commit 52e5008bf4
4 changed files with 21 additions and 30 deletions
+6 -5
View File
@@ -49,7 +49,7 @@ public:
SideChain& side_chain() { return *m_sideChain; }
const MinerData& miner_data() const { return m_minerData; }
p2pool_api* m_api;
p2pool_api* api() const { return m_api; }
RandomX_Hasher* hasher() const { return m_hasher; }
bool calculate_hash(const void* data, size_t size, const hash& seed, hash& result);
@@ -76,10 +76,6 @@ public:
void api_update_block_found(const ChainMain* data);
void api_update_network_stats();
void api_update_pool_stats();
void api_update_stats_mod();
bool get_difficulty_at_height(uint64_t height, difficulty_type& diff);
private:
@@ -96,6 +92,7 @@ private:
Params* m_params;
p2pool_api* m_api;
SideChain* m_sideChain;
RandomX_Hasher* m_hasher;
BlockTemplate* m_blockTemplate;
@@ -126,6 +123,10 @@ private:
bool parse_block_header(const char* data, size_t size, ChainMain& result);
uint32_t parse_block_headers_range(const char* data, size_t size);
void api_update_network_stats();
void api_update_pool_stats();
void api_update_stats_mod();
struct FoundBlock
{
FORCEINLINE FoundBlock(time_t _t, uint64_t _h, const hash& _id, const difficulty_type& _block_diff, const difficulty_type& _total_hashes)