changeset 23728:7ec35f979a30

Merge branch '0.12bu' of https://github.com/hfinger/BitcoinUnlimited into BUIP010
author hfinger <holgerfinger@gmail.com>
date Mon, 07 Mar 2016 20:49:11 -0500
parents e4cf7dea7306 cdbf1d05d408
children aa9d6c8df05b 8d208de12bcc c7833a5d5e9f 3820c2697de5
files src/main.cpp
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.cpp	Mon Mar 07 20:42:02 2016 -0500
+++ b/src/main.cpp	Mon Mar 07 20:49:11 2016 -0500
@@ -5347,14 +5347,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 )
                      );
             std::vector<CTransaction> vTx = pfrom->thinBlock.vtx;
             HandleBlockMessage(pfrom, strCommand, pfrom->thinBlock, inv);