insightexplorer minor bug fixes

This commit is contained in:
Larry Ruane 2019-08-08 14:45:30 -06:00
parent 5bba8493d5
commit 6e7e50be4d
4 changed files with 7 additions and 2 deletions

View File

@ -1632,7 +1632,7 @@ bool GetSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value)
{
AssertLockHeld(cs_main);
if (!fSpentIndex)
return false;
return error("spent index not enabled");
if (mempool.getSpentIndex(key, value))
return true;
return pblocktree->ReadSpentIndex(key, value);

View File

@ -190,6 +190,7 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex)
if (IsValidDestination(dest)) {
delta.push_back(Pair("address", EncodeDestination(dest)));
}
delta.push_back(Pair("address", EncodeDestination(dest)));
delta.push_back(Pair("satoshis", out.nValue));
delta.push_back(Pair("index", (int)k));

View File

@ -108,6 +108,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "getblockhashes", 0},
{ "getblockhashes", 1},
{ "getblockhashes", 2},
{ "getblockdeltas", 0},
{ "zcrawjoinsplit", 1 },
{ "zcrawjoinsplit", 2 },
{ "zcrawjoinsplit", 3 },

View File

@ -439,7 +439,10 @@ BOOST_AUTO_TEST_CASE(rpc_insightexplorer)
CheckRPCThrows("getspentinfo {\"txid\":\"hello\",\"index\":0}",
"txid must be hexadecimal string (not 'hello')");
CheckRPCThrows("getblockdeltas \"00040fe8ec8471911baa1db1266ea15dd06b4a8a5c453883c000b031973dce08\"",
// only the mainnet genesis block exists
BOOST_CHECK_NO_THROW(CallRPC("getblockdeltas \"00040fe8ec8471911baa1db1266ea15dd06b4a8a5c453883c000b031973dce08\""));
// damage the block hash (change last digit)
CheckRPCThrows("getblockdeltas \"00040fe8ec8471911baa1db1266ea15dd06b4a8a5c453883c000b031973dce09\"",
"Block not found");
BOOST_CHECK_NO_THROW(CallRPC("getblockhashes 1477641360 1477641360"));