From e788a5ab2d43634211b46e34adde7d3c92feaacb Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 13 Mar 2017 08:11:44 +0300 Subject: [PATCH] Fail to proceed in listsinceblock if provided blockhash can't be found 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) https://github.com/bitcoin/bitcoin/commit/3a6e468d9a0caceea80f274967bb0cf6aecdc8f1 --- src/wallet/rpcwallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a82de3fa43876..11c4166adec3b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1767,6 +1767,8 @@ UniValue listsinceblock(const UniValue& params, bool fHelp) BlockMap::iterator it = mapBlockIndex.find(blockId); if (it != mapBlockIndex.end()) pindex = it->second; + else + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid blockhash"); } if (params.size() > 1)