Fail to proceed in listsinceblock if provided blockhash can't be found (#1393)

If daemon crashes, it can't save latest block sometimes, so querying daemon
for presumably best/last hash would result in a list of all txes recognized by
this wallet as its own since genesis block which could be confusing,
to say at least. Same applies for typos etc. This should fix it.

Not sure why but such weird behaviour was the case since listsinceblock rpc was
initially introduced in Bitcoin 0.5 (Oct 5, 2011)
3a6e468d9a
This commit is contained in:
UdjinM6 2017-03-13 09:29:01 +03:00 committed by Holger Schinzel
parent c523205386
commit 6aaec3ae2a

View File

@ -1767,6 +1767,8 @@ UniValue listsinceblock(const UniValue& params, bool fHelp)
BlockMap::iterator it = mapBlockIndex.find(blockId); BlockMap::iterator it = mapBlockIndex.find(blockId);
if (it != mapBlockIndex.end()) if (it != mapBlockIndex.end())
pindex = it->second; pindex = it->second;
else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid blockhash");
} }
if (params.size() > 1) if (params.size() > 1)