I am seeing incidents of verack messages being processed before the version messages from peers (outbound connections). The impact of this is that certain functions done upon receipt of verack therefore do not happen. Could perhaps the functionality performed upon receipt of verack be either moved to what is done upon receipt of "version" messages, or perhaps the messages as they are received could be queued to be processed after the "version" message is received?
Details from debug.log:-
2016-08-07 08:09:07 Outbound connection 46.227.201.91:8333 peer=2 2016-08-07 08:09:07 Misbehaving: peer=2 (0 -> 1) 2016-08-07 08:09:07 ProcessMessages(verack, 0 bytes) FAILED peer=2 2016-08-07 08:09:07 receive version message: /Satoshi:0.12.1/: version 70002, blocks=424091, us=x.x.x.x:8333, them=46.227.201.91:8333, peer=2 2016-08-07 08:19:34 Outbound connection 46.227.201.91:8333 peer=8 2016-08-07 08:19:34 Misbehaving: peer=8 (0 -> 1) 2016-08-07 08:19:34 ProcessMessages(verack, 0 bytes) FAILED peer=8 2016-08-07 08:19:34 receive version message: /Satoshi:0.12.1/: version 70002, blocks=424092, us=x.x.x.x:8333, them=46.227.201.91:8333, peer=8 2016-08-09 03:15:36 Misbehaving: peer=11 (0 -> 1) 2016-08-09 03:15:36 ProcessMessages(verack, 0 bytes) FAILED peer=11 2016-08-09 03:15:36 receive version message: /Satoshi:0.12.1/: version 70002, blocks=424364, us=x.x.x.x:8333, them=46.227.201.91:8333, peer=11 2016-08-14 14:11:58 Outbound connection 46.227.201.91:8333 peer=4 2016-08-14 14:11:59 Misbehaving: peer=4 (0 -> 1) 2016-08-14 14:11:59 ProcessMessages(verack, 0 bytes) FAILED peer=4 2016-08-14 14:11:59 receive version message: /Satoshi:0.12.1/: version 70002, blocks=425181, us=x.x.x.x:8333, them=46.227.201.91:8333, peer=4
Ok, I realize all these examples are the same node, so it may be that this situation is so rare it doesn't deserve any energy devoted to it, but I think it does raise some questions: why the policy of Misbehave +1 for each message before a version message - i.e. why allow 99 messages before banning? And What exactly is the purpose of verack? What should be done before a verack is sent and what should be dependent on a verack being received?