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;