4967 | + pfrom->nStartingHeight, addrMe.ToString(), pfrom->id,
4968 | + remoteAddr);
4969 | +
4970 | + if (pfrom->nServicesExpected != pfrom->nServices) {
4971 | + LogPrint("net", "peer=%d does not offer the expected services (%08x offered, %08x expected)", pfrom->id, pfrom->nServices, pfrom->nServicesExpected);
4972 | + if (pfrom->nServicesExpected & nRelevantServices & ~pfrom->nServices) {
It seems to me that nServicesExpected doesn't need to be mentioned here at all. It's irrelevant. It's simply what was advertised in the addresses messages. If nServices includes all the relevant services then surely the connection should remain. Firstly, the network selection code is such that if the relevant services wasn't present in ExpectedServices it wouldn't even have tried connecting to it. and secondly, even if the network selection code tries connecting to it, then as long as nServices (the latest update of what the node provides) includes the relevant services, the connection should remain even if the ExpectedServices (an out of date snapshot of what other nodes say the node provides) says it doesn't provide the service.
I therefore propose changing this line to:-
if (nRelevantServices & ~pfrom->nServices) {
any objections?