fix issue where getrawtransaction RPC call does not work

This happens when a block is orphaned, the coinbase and coinstake transactions cannot be fetched with getrawtransaction.