aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2016-10-04 13:49:44 -0400
committerMatt Corallo <git@bluematt.me>2016-10-04 13:49:44 -0400
commitfef1010199b70026fd6d56ebac5c277552757307 (patch)
tree9590c91b21f6b1a3a3c36d9463f197725d4d8e3d /src/init.cpp
parentaefcb7b70c923ccd341329a2d5e22238dc14ac3b (diff)
Use CValidationInterface from chain logic to notify peer logic
This adds a new CValidationInterface subclass, defined in main.h, to receive notifications of UpdatedBlockTip and use that to push blocks to peers, instead of doing it directly from ActivateBestChain.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index eefef7ba0b..7045b3e6e1 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -72,6 +72,7 @@ static const bool DEFAULT_DISABLE_SAFEMODE = false;
static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
std::unique_ptr<CConnman> g_connman;
+std::unique_ptr<PeerLogicValidation> peerLogic;
#if ENABLE_ZMQ
static CZMQNotificationInterface* pzmqNotificationInterface = NULL;
@@ -200,6 +201,8 @@ void Shutdown()
pwalletMain->Flush(false);
#endif
MapPort(false);
+ UnregisterValidationInterface(peerLogic.get());
+ peerLogic.reset();
g_connman.reset();
StopTorControl();
@@ -1102,6 +1105,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
g_connman = std::unique_ptr<CConnman>(new CConnman(GetRand(std::numeric_limits<uint64_t>::max()), GetRand(std::numeric_limits<uint64_t>::max())));
CConnman& connman = *g_connman;
+ peerLogic.reset(new PeerLogicValidation(&connman));
+ RegisterValidationInterface(peerLogic.get());
RegisterNodeSignals(GetNodeSignals());
// sanitize comments per BIP-0014, format user agent and check total size