From 85245f1e633d2894485b93af9ef2e414c656b962 Mon Sep 17 00:00:00 2001 From: Warren Togami Date: Fri, 23 Jan 2015 01:40:05 -1000 Subject: [PATCH] Litecoin: Relay alerts prior to MIN_PEER_PROTO_VERSION disconnect Otherwise the old client may fail to receive an alert saying they need to upgrade. --- src/main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 84dba3d82..5632485da 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3287,6 +3287,12 @@ string GetWarnings(string strFor) } +void static RelayAlerts(CNode* pfrom) +{ + LOCK(cs_mapAlerts); + BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) + item.second.RelayTo(pfrom); +} @@ -3479,6 +3485,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) { + // relay alerts prior to disconnection + RelayAlerts(pfrom); // disconnect from peers older than this proto version LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion); pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE, @@ -3560,11 +3568,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } // Relay alerts - { - LOCK(cs_mapAlerts); - BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) - item.second.RelayTo(pfrom); - } + RelayAlerts(pfrom); pfrom->fSuccessfullyConnected = true;