Skip to content

Commit 06814a1

Browse files
committed
Cleanup comments and unused functions
1 parent 2e4a8f6 commit 06814a1

File tree

5 files changed

+23
-25
lines changed

5 files changed

+23
-25
lines changed

src/miner/internal/hash-rate-counter.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
#include "utiltime.h"
88

99

10-
HashRateCounter::HashRateCounter() : _parent(nullptr){};
11-
HashRateCounter::HashRateCounter(HashRateCounterRef parent) : _parent(parent){};
12-
1310
void HashRateCounter::Increment(int64_t amount)
1411
{
1512
// Set start time if not set and return

src/miner/internal/hash-rate-counter.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,12 @@ struct HashRateCounter : public std::enable_shared_from_this<HashRateCounter> {
2424
HashRateCounterRef _parent;
2525

2626
public:
27-
HashRateCounter();
28-
explicit HashRateCounter(HashRateCounterRef counter);
27+
explicit HashRateCounter() : _parent(nullptr){};
28+
explicit HashRateCounter(HashRateCounterRef parent) : _parent(parent){};
2929

3030
// Returns hash rate per second
3131
operator int64_t() { return _count_per_sec; };
3232

33-
// Creates new counter
34-
static HashRateCounterRef Make() { return std::make_shared<HashRateCounter>(); }
35-
3633
// Creates new child counter
3734
HashRateCounterRef MakeChild() { return std::make_shared<HashRateCounter>(shared_from_this()); }
3835

src/miner/internal/miner-context.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
#include "miner/miner-util.h"
77
#include "validation.h"
88

9+
MinerContext::MinerContext(const CChainParams& chainparams_, CConnman& connman_)
10+
: counter(std::make_shared<HashRateCounter>()),
11+
shared(std::make_shared<MinerSharedContext>(chainparams_, connman_)){};
12+
13+
MinerContext::MinerContext(MinerSharedContextRef shared_, HashRateCounterRef counter_)
14+
: counter(counter_), shared(shared_){};
15+
916
void MinerSharedContext::RecreateBlock()
1017
{
1118
// First we increment flag

src/miner/internal/miner-context.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,8 @@ class MinerContext
7979
HashRateCounterRef counter;
8080
MinerSharedContextRef shared;
8181

82-
MinerContext(const CChainParams& chainparams_, CConnman& connman_)
83-
: counter(HashRateCounter::Make()), shared(std::make_shared<MinerSharedContext>(chainparams_, connman_)){};
84-
85-
MinerContext(MinerSharedContextRef shared_, HashRateCounterRef counter_)
86-
: counter(counter_), shared(shared_){};
82+
MinerContext(const CChainParams& chainparams_, CConnman& connman_);
83+
MinerContext(MinerSharedContextRef shared_, HashRateCounterRef counter_);
8784

8885
// Constructs child context
8986
explicit MinerContext(const MinerContext* ctx_)

src/miner/internal/miners-controller.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,24 @@ class MinersController
4242
int64_t _last_sync_time = 0;
4343

4444
public:
45-
MinersController(MinerContextRef ctx);
4645
MinersController(const CChainParams& chainparams, CConnman& connman);
46+
MinersController(MinerContextRef ctx);
4747
virtual ~MinersController() = default;
4848

49-
/** Starts miners */
49+
// Starts miners
5050
void Start();
5151

52-
/** Shuts down all miner threads */
52+
// Shuts down all miner threads
5353
void Shutdown();
5454

55-
/** Gets combined hash rate of GPU and CPU */
55+
// Gets combined hash rate of GPU and CPU
5656
int64_t GetHashRate() const;
5757

58-
/** Returns CPU miners thread group */
58+
// Returns CPU miners thread group
5959
MinersThreadGroup<CPUMiner>& group_cpu() { return _group_cpu; }
6060

6161
#ifdef ENABLE_GPU
62-
/** Returns GPU miners thread group */
62+
// Returns GPU miners thread group
6363
MinersThreadGroup<GPUMiner>& group_gpu()
6464
{
6565
return _group_gpu;
@@ -69,23 +69,23 @@ class MinersController
6969
private:
7070
void StartIfEnabled();
7171

72-
/** Returns true if can start */
72+
// Returns true if can start
7373
bool can_start() const { return _connected && _downloaded && _enable_start && _ctx->shared->has_block(); }
7474

7575
protected:
76-
/** Returns shared miner context */
76+
// Returns shared miner context
7777
MinerContextRef ctx() const { return _ctx; }
7878

79-
/** Handles new node connection */
79+
// Handles new node connection
8080
virtual void NotifyNode(const CNode* node);
8181

82-
/** Handles updated blockchain tip */
82+
// Handles updated blockchain tip
8383
virtual void NotifyBlock(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload);
8484

85-
/** Handles new transaction */
85+
// Handles new transaction
8686
virtual void NotifyTransaction(const CTransaction& tx, const CBlockIndex* pindex, int posInBlock);
8787

88-
/** Connects signals to controller */
88+
// Connects signals to controller
8989
friend void ConnectMinerSignals(MinersController*);
9090
};
9191

0 commit comments

Comments
 (0)