From 6aaec3ae2a3e1534f60959296e0e314f266ca57a Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 13 Mar 2017 09:29:01 +0300 Subject: [PATCH] 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) 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 a82de3fa43..11c4166ade 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)