aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@exmulti.com>2012-07-05 15:28:42 -0700
committerJeff Garzik <jgarzik@exmulti.com>2012-07-05 15:28:42 -0700
commit6e3a1a374293a8a5adeb2ad464f7205e819585ee (patch)
tree50cc8d6cf558c68f63bcccc74342da14154f2f12
parent698b9f3095f5a89126976593382e3af2c1152165 (diff)
parente69a7979901d1df8f0d90fcd4e1a21eb1fd38602 (diff)
downloadbitcoin-6e3a1a374293a8a5adeb2ad464f7205e819585ee.tar.xz
Merge pull request #1304 from rebroad/ShowBlockTimestamp
Show block timestamp
-rw-r--r--src/db.cpp4
-rw-r--r--src/main.cpp13
2 files changed, 13 insertions, 4 deletions
diff --git a/src/db.cpp b/src/db.cpp
index ecdf32a8f0..e494d28e3c 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -510,7 +510,9 @@ bool CTxDB::LoadBlockIndex()
pindexBest = mapBlockIndex[hashBestChain];
nBestHeight = pindexBest->nHeight;
bnBestChainWork = pindexBest->bnChainWork;
- printf("LoadBlockIndex(): hashBestChain=%s height=%d\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight);
+ printf("LoadBlockIndex(): hashBestChain=%s height=%d date=%s\n",
+ hashBestChain.ToString().substr(0,20).c_str(), nBestHeight,
+ DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str());
// Load bnBestInvalidWork, OK if it doesn't exist
ReadBestInvalidWork(bnBestInvalidWork);
diff --git a/src/main.cpp b/src/main.cpp
index 8e1deac4bb..b4e827098e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -968,8 +968,13 @@ void static InvalidChainFound(CBlockIndex* pindexNew)
CTxDB().WriteBestInvalidWork(bnBestInvalidWork);
uiInterface.NotifyBlocksChanged();
}
- printf("InvalidChainFound: invalid block=%s height=%d work=%s\n", pindexNew->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->nHeight, pindexNew->bnChainWork.ToString().c_str());
- printf("InvalidChainFound: current best=%s height=%d work=%s\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str());
+ printf("InvalidChainFound: invalid block=%s height=%d work=%s date=%s\n",
+ pindexNew->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->nHeight,
+ pindexNew->bnChainWork.ToString().c_str(), DateTimeStrFormat("%x %H:%M:%S",
+ pindexNew->GetBlockTime()).c_str());
+ printf("InvalidChainFound: current best=%s height=%d work=%s date=%s\n",
+ hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str(),
+ DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str());
if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6)
printf("InvalidChainFound: WARNING: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n");
}
@@ -1611,7 +1616,9 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew)
bnBestChainWork = pindexNew->bnChainWork;
nTimeBestReceived = GetTime();
nTransactionsUpdated++;
- printf("SetBestChain: new best=%s height=%d work=%s\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str());
+ printf("SetBestChain: new best=%s height=%d work=%s date=%s\n",
+ hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str(),
+ DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str());
std::string strCmd = GetArg("-blocknotify", "");