Restarted test node @ +/- few seconds Mon Mar 2 13:06:24 CDT 2020 Starting up at max height... 619875 LoadBlockIndex(): hashBestChain=00000000000000000005c533584904108f0ec0485fc4e5a6520ce519ad191d70 height=619875 Complete. Ready, has 15 connections. (TRB using -maxsendbuffer=100000 ) -------------------------------------------------------------------------- Code changes: Patched TRB. Want to capture pmap output before, during, and after wedge as well. Idea is here to show that one can still utilize the -maxsendbuffer to override the 10Mb default limit to an abitrary larger limit of 100Mb. 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 10: 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 pmap 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=619875 Sending 1799991-byte message packet... Now listening for replies (Ctl-C to quit...) Violated BTC Protocol: Invalid payload length! Found in debug.log: getdata (block) may not transmit 100115145 bytes Working as expected. Did not wedge. Responding to RPC commands normally.