Browse Source

More debug output for failed reorganizations

0.8
Pieter Wuille 13 years ago
parent
commit
a1a0469f91
  1. 10
      src/main.cpp

10
src/main.cpp

@ -1382,6 +1382,9 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
vConnect.push_back(pindex); vConnect.push_back(pindex);
reverse(vConnect.begin(), vConnect.end()); 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 // Disconnect shorter branch
vector<CTransaction> vResurrect; vector<CTransaction> vResurrect;
BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) BOOST_FOREACH(CBlockIndex* pindex, vDisconnect)
@ -1390,7 +1393,7 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
if (!block.ReadFromDisk(pindex)) if (!block.ReadFromDisk(pindex))
return error("Reorganize() : ReadFromDisk for disconnect failed"); return error("Reorganize() : ReadFromDisk for disconnect failed");
if (!block.DisconnectBlock(txdb, pindex)) 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 // Queue memory transactions to resurrect
BOOST_FOREACH(const CTransaction& tx, block.vtx) BOOST_FOREACH(const CTransaction& tx, block.vtx)
@ -1410,7 +1413,7 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
{ {
// Invalid block // Invalid block
txdb.TxnAbort(); 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 // Queue memory transactions to delete
@ -1442,8 +1445,7 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
BOOST_FOREACH(CTransaction& tx, vDelete) BOOST_FOREACH(CTransaction& tx, vDelete)
tx.RemoveFromMemoryPool(); 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: done\n");
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());
return true; return true;
} }

Loading…
Cancel
Save