More debug output for failed reorganizations

This commit is contained in:
Pieter Wuille 2012-03-21 13:15:27 +01:00
parent 6565f4e855
commit a1a0469f91

View file

@ -1382,6 +1382,9 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
vConnect.push_back(pindex);
reverse(vConnect.begin(), vConnect.end());
printf("REORGANIZE: Disconnect %i blocks; %s..%s\n", vDisconnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexBest->GetBlockHash().ToString().substr(0,20).c_str());
printf("REORGANIZE: Connect %i blocks; %s..%s\n", vConnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->GetBlockHash().ToString().substr(0,20).c_str());
// Disconnect shorter branch
vector<CTransaction> vResurrect;
BOOST_FOREACH(CBlockIndex* pindex, vDisconnect)
@ -1390,7 +1393,7 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
if (!block.ReadFromDisk(pindex))
return error("Reorganize() : ReadFromDisk for disconnect failed");
if (!block.DisconnectBlock(txdb, pindex))
return error("Reorganize() : DisconnectBlock failed");
return error("Reorganize() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().substr(0,20).c_str());
// Queue memory transactions to resurrect
BOOST_FOREACH(const CTransaction& tx, block.vtx)
@ -1410,7 +1413,7 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
{
// Invalid block
txdb.TxnAbort();
return error("Reorganize() : ConnectBlock failed");
return error("Reorganize() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().substr(0,20).c_str());
}
// Queue memory transactions to delete
@ -1442,8 +1445,7 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
BOOST_FOREACH(CTransaction& tx, vDelete)
tx.RemoveFromMemoryPool();
printf("REORGANIZE: Disconnected %i blocks; %s..%s\n", vDisconnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexBest->GetBlockHash().ToString().substr(0,20).c_str());
printf("REORGANIZE: Connected %i blocks; %s..%s\n", vConnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->GetBlockHash().ToString().substr(0,20).c_str());
printf("REORGANIZE: done\n");
return true;
}