diff -uNr a/bitcoin/manifest.txt b/bitcoin/manifest.txt --- a/bitcoin/manifest.txt 606e88f58085d688d8bbac0bec1921c583638448703f31ed9fc8e28c6ce7113fd718390dc7013e6c7f29d48bcce41cfbb26662490e0af67cf525971a344e4377 +++ b/bitcoin/manifest.txt ee37022b25601010b55c574cdabfce67f0d60b1003490ac6b5e3e9bfca1d815b6856f865ad81423b42d87e4f631fd2d51192175fab9d958809ee21395aee3565 @@ -27,3 +27,4 @@ 542413 makefiles mod6 Add makefiles to build entire TRB 542413 asciilifeform_aggressive_pushgetblocks asciilifeform Issue PushGetBlocks command to any peer that issues 'version' command 542413 mod6_excise_hash_truncation mod6 Regrind of ben_vulpes original; removes truncation of hashes printed to TRB log file +543661 asciilifeform_whogaveblox asciilifeform Record the origin of every incoming candidate block (whether accepted or rejected) diff -uNr a/bitcoin/src/main.cpp b/bitcoin/src/main.cpp --- a/bitcoin/src/main.cpp 91083aa2a87b340863c1a6e1d12075dab306d8342813b4cadc383218e54657ca2a082afb6067cc3cf42752504e850b619ec40809d7dd433524487d88c4b19e7e +++ b/bitcoin/src/main.cpp 46d5ea6863017d7ba2b1943c59e8b2ac82cc322dc4076a36983e6849db5dcee334982bf62aa41b604626619e36ea88f12f85fc41bcb9ced0bfbb02997ae5a3d3 @@ -1322,14 +1322,25 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock) { + // Whose block we are trying. + string peer_ip; + + if (pfrom) { + peer_ip = pfrom->addr.ToStringIP(); // if candidate block came from a peer + } else { + peer_ip = "LOCAL"; // if it came from, e.g., EatBlock + } + // Check for duplicate uint256 hash = pblock->GetHash(); if (mapBlockIndex.count(hash)) - return error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, hash.ToString().c_str()); + return error("ProcessBlock() : already have block %d %s from peer %s", + mapBlockIndex[hash]->nHeight, hash.ToString().c_str(), + peer_ip.c_str()); // Preliminary checks if (!pblock->CheckBlock()) - return error("ProcessBlock() : CheckBlock FAILED"); + return error("ProcessBlock() : CheckBlock FAILED from peer %s", peer_ip.c_str()); CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); if (pcheckpoint && pblock->hashPrevBlock != hashBestChain) @@ -1340,7 +1351,8 @@ { if (pfrom) pfrom->Misbehaving(100); - return error("ProcessBlock() : block with timestamp before last checkpoint"); + return error("ProcessBlock() : block with timestamp before last checkpoint from peer %s", + peer_ip.c_str()); } CBigNum bnNewBlock; bnNewBlock.SetCompact(pblock->nBits); @@ -1350,14 +1362,17 @@ { if (pfrom) pfrom->Misbehaving(100); - return error("ProcessBlock() : block with too little proof-of-work"); + return error("ProcessBlock() : block with too little proof-of-work from peer %s", + peer_ip.c_str()); } } // If don't already have its previous block, throw it out! if (!mapBlockIndex.count(pblock->hashPrevBlock)) { - printf("ProcessBlock: BASTARD BLOCK, prev=%s, DISCARDED\n", pblock->hashPrevBlock.ToString().c_str()); + printf("ProcessBlock: BASTARD BLOCK, prev=%s, DISCARDED from peer %s\n", + pblock->hashPrevBlock.ToString().c_str(), + peer_ip.c_str()); // Ask this guy to fill in what we're missing if (pfrom) @@ -1368,9 +1383,11 @@ // Store to disk if (!pblock->AcceptBlock()) - return error("ProcessBlock() : AcceptBlock FAILED"); - - printf("ProcessBlock: ACCEPTED\n"); + return error("ProcessBlock() : AcceptBlock FAILED from peer %s", peer_ip.c_str()); + + printf("ProcessBlock: ACCEPTED block %s from: %s\n", + hash.ToString().c_str(), peer_ip.c_str()); + return true; }