Use a 64-bit nonce in ping
authorPieter Wuille <pieter.wuille@gmail.com>
Thu, 14 Jun 2012 16:31:08 +0000 (18:31 +0200)
committerGavin Andresen <gavinandresen@gmail.com>
Tue, 19 Jun 2012 19:38:58 +0000 (15:38 -0400)
Former code sent '0' as nonce, which was serialized as 32-bit.

src/main.cpp

index c27115d..27feeca 100644 (file)
@@ -2898,8 +2898,9 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
         // Keep-alive ping. We send a nonce of zero because we don't use it anywhere
         // right now.
         if (pto->nLastSend && GetTime() - pto->nLastSend > 30 * 60 && pto->vSend.empty()) {
+            uint64 nonce = 0;
             if (pto->nVersion > BIP0031_VERSION)
-                pto->PushMessage("ping", 0);
+                pto->PushMessage("ping", nonce);
             else
                 pto->PushMessage("ping");
         }