mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 20:44:56 +00:00
handle block db inconsistency more nicely
This commit is contained in:
parent
5b3fb45b81
commit
38052af55d
@ -149,6 +149,11 @@ Value getblockhash(const Array& params, bool fHelp)
|
||||
throw runtime_error("Block number out of range.");
|
||||
|
||||
CBlockIndex* pblockindex = FindBlockByHeight(nHeight);
|
||||
if (pblockindex == NULL) {
|
||||
string errormsg = "getblockhash internal error: pblockindex == NULL. consider reindexing blocks (program may crash)";
|
||||
printf("%s\n",errormsg.c_str());
|
||||
throw runtime_error(errormsg);
|
||||
}
|
||||
return pblockindex->phashBlock->GetHex();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user