Does the getblock(hash) RPC call always return a "previousblockhash" field and if not: under what conditions does it not return this?
Background: many algorithms suggest using this field as a way to step back in the blockchain when an orphan or reorganization occurs but the C++ code would indicate this field isn't always present.
if (blockindex->pprev)
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
Would that be due to chain reorganizations and orphans? Can anyone explain what dynamics would make this check fail and what the next step would be if it does?
previousblockhash
for thegenesis
block, for instance.getblockheader
was indeed added becausegetblock
can fail when a block is pruned, but even then, the index entries remain. See my answer.