Skip to content

Commit

Permalink
slightly refactor CDSNotificationInterface (#1581)
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 authored Aug 28, 2017
1 parent 8012f2c commit b5f7be6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
10 changes: 4 additions & 6 deletions src/dsnotificationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@
#include "masternode-sync.h"
#include "privatesend-client.h"

CDSNotificationInterface::CDSNotificationInterface()
{
}

CDSNotificationInterface::~CDSNotificationInterface()
void CDSNotificationInterface::InitializeCurrentBlockTip()
{
LOCK(cs_main);
UpdatedBlockTip(chainActive.Tip(), NULL, IsInitialBlockDownload());
}

void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
{
if (fInitialDownload || pindexNew == pindexFork) // In IBD or blocks were disconnected without any new ones
return;
return;

mnodeman.UpdatedBlockTip(pindexNew);
privateSendClient.UpdatedBlockTip(pindexNew);
Expand Down
12 changes: 7 additions & 5 deletions src/dsnotificationinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
class CDSNotificationInterface : public CValidationInterface
{
public:
// virtual CDSNotificationInterface();
CDSNotificationInterface();
virtual ~CDSNotificationInterface();
CDSNotificationInterface() = default;
virtual ~CDSNotificationInterface() = default;

// a small helper to initialize current block height in sub-modules on startup
void InitializeCurrentBlockTip();

protected:
// CValidationInterface
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload);
void SyncTransaction(const CTransaction &tx, const CBlock *pblock);
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
void SyncTransaction(const CTransaction &tx, const CBlock *pblock) override;

private:
};
Expand Down
6 changes: 1 addition & 5 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1975,11 +1975,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// force UpdatedBlockTip to initialize nCachedBlockHeight for DS, MN payments and budgets
// but don't call it directly to prevent triggering of other listeners like zmq etc.
// GetMainSignals().UpdatedBlockTip(chainActive.Tip());
mnodeman.UpdatedBlockTip(chainActive.Tip());
privateSendClient.UpdatedBlockTip(chainActive.Tip());
mnpayments.UpdatedBlockTip(chainActive.Tip());
masternodeSync.UpdatedBlockTip(chainActive.Tip(), IsInitialBlockDownload());
governance.UpdatedBlockTip(chainActive.Tip());
pdsNotificationInterface->InitializeCurrentBlockTip();

// ********************************************************* Step 11d: start dash-ps-<smth> threads

Expand Down

0 comments on commit b5f7be6

Please sign in to comment.