changeset 23727:cdbf1d05d408

fixed compression ratio reporting to include re-requested txs.
author Holger Finger <holgerfinger@gmail.com>
date Wed, 02 Mar 2016 13:20:55 +0100
parents bac3c81409ed
children 7ec35f979a30
files src/main.cpp
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.cpp	Thu Feb 25 14:44:27 2016 -0500
+++ b/src/main.cpp	Wed Mar 02 13:20:55 2016 +0100
@@ -5244,14 +5244,17 @@
         if (pfrom->thinBlockWaitingForTxns == 0) {
             // We have all the transactions now that are in this block: try to reassemble and process.
             pfrom->thinBlockWaitingForTxns = -1;
-            pfrom->AddInventoryKnown(inv); 
-
+            pfrom->AddInventoryKnown(inv);
+
+            // for compression statistics, we have to add up the size of xthinblock and the re-requested thinBlockTx.
+            int nSizeThinBlockTx = ::GetSerializeSize(thinBlockTx, SER_NETWORK, PROTOCOL_VERSION);
             int blockSize = pfrom->thinBlock.GetSerializeSize(SER_NETWORK, CBlock::CURRENT_VERSION);
-            LogPrint("thin", "Reassembled thin block for %s (%d bytes). Message was %d bytes, compression ratio %3.2f\n",
+            LogPrint("thin", "Reassembled thin block for %s (%d bytes). Message was %d bytes (thinblock) and %d bytes (re-requested tx), compression ratio %3.2f\n",
                      pfrom->thinBlock.GetHash().ToString(),
                      blockSize,
                      pfrom->nSizeThinBlock,
-                     ((float) blockSize) / ((float) pfrom->nSizeThinBlock)
+                     nSizeThinBlockTx,
+                     ((float) blockSize) / ( (float) pfrom->nSizeThinBlock + (float) nSizeThinBlockTx )
                      );
             HandleBlockMessage(pfrom, strCommand, pfrom->thinBlock, inv);
         }