Restarted test node @ +/- few seconds Fri Feb 28 12:01:52 CDT 2020 Catching up to max height... 619405 SetBestChain: new best=000000000000000000023542de57440e7299fb8352bfba8e4fa81adffbe91b85 height=619405 work=4060341488699729402288581694 Complete. Ready, has 11 connections. -------------------------------------------------------------------------- Code changes: mod6@localhost ~/trb-keccak $ vdiff a b diff -uNr a/bitcoin/src/main.cpp b/bitcoin/src/main.cpp --- a/bitcoin/src/main.cpp 1f0735d2cee2f9ca2a177aead4ecc7a1371d59c4375aedb172ee99c28b02fa28e664decec9580a510bfca4738d85e377fb74396fe4979b75adbe1a3ec92b01c9 +++ b/bitcoin/src/main.cpp 1badf11c795508db8daa9b4bc5b3e525633669cd4010bbd3f85ada5acc89627d92ddb51faa10d7b28ccaf269d4376c6ff0d55e53501e3a19d8d654eaa70a85d9 @@ -1877,6 +1877,8 @@ return error("message getdata size() = %d", vInv.size()); } + // Counter of bytes sent in response to this 'getdata' command + unsigned int sentBytes = 0; BOOST_FOREACH(const CInv& inv, vInv) { if (fShutdown) @@ -1891,6 +1893,15 @@ { CBlock block; block.ReadFromDisk((*mi).second); + + // Add block's size to sentBytes, and determine if reached limit + sentBytes += block.GetSerializeSize(SER_NETWORK); + if (sentBytes >= SendBufferSize()) + { + printf("getdata (block) may not transmit %u bytes\n", sentBytes); + pfrom->Misbehaving(20); + break; + } pfrom->PushMessage("block", block); // Trigger them to send a getblocks request for the next batch of inventory @@ -1913,7 +1924,16 @@ { map::iterator mi = mapRelay.find(inv); if (mi != mapRelay.end()) + { + //nBytes += ((*mi).second).GetSerializeSize(SER_NETWORK); + //if (nBytes >= SendBufferSize()) + //{ + // printf("getdata stopping at %u bytes\n", nBytes); + // pfrom->Misbehaving(100); + // break; + //} pfrom->PushMessage(inv.GetCommand(), (*mi).second); + } } } else -------------------------------------------------------------------------- Test 8: Send 49999 'getdata for block' commands to the node, see how it reacts and if it recovers. Host, Port, File = 127.0.0.1, 8333, snap_49999.txt Collect vmstat before, during, and after. mod6@localhost ~ $ ./wedger.py 127.0.0.1 8333 snap_49999.txt Alive: V=99999 (/therealbitcoin.org:0.9.99.99/) Jumpers=0x1 (TRB-Compat.) Return Addr=1.2.3.4:8333 Blocks=619405 Sending 1799991-byte message packet... Now listening for replies (Ctl-C to quit...) .... Violated BTC Protocol: Bad header length! Did not get wedged. Succesfully responding to RPC commands. Kept sync. Finshed with 619421 blocks, same as others fully syncd. Looking good.