Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions src/rpc/index_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ bool GetAddressIndex(CBlockTreeDB& block_tree_db, const uint160& addressHash, co
AssertLockHeld(::cs_main);
EnsureAddressIndexAvailable();

if (!block_tree_db.ReadAddressIndex(addressHash, type, addressIndex, start, end)) {
return error("Unable to get txids for address");
}

return true;
return block_tree_db.ReadAddressIndex(addressHash, type, addressIndex, start, end);
}

bool GetAddressUnspentIndex(CBlockTreeDB& block_tree_db, const uint160& addressHash, const AddressType type,
Expand All @@ -40,7 +36,7 @@ bool GetAddressUnspentIndex(CBlockTreeDB& block_tree_db, const uint160& addressH
EnsureAddressIndexAvailable();

if (!block_tree_db.ReadAddressUnspentIndex(addressHash, type, unspentOutputs))
return error("Unable to get txids for address");
return false;

if (height_sort) {
std::sort(unspentOutputs.begin(), unspentOutputs.end(),
Expand All @@ -60,7 +56,7 @@ bool GetMempoolAddressDeltaIndex(const CTxMemPool& mempool,
EnsureAddressIndexAvailable();

if (!mempool.getAddressIndex(addressDeltaIndex, addressDeltaEntries))
return error("Unable to get address delta information");
return false;

if (timestamp_sort) {
std::sort(addressDeltaEntries.begin(), addressDeltaEntries.end(),
Expand All @@ -84,10 +80,7 @@ bool GetSpentIndex(CBlockTreeDB& block_tree_db, const CTxMemPool& mempool, const
if (mempool.getSpentIndex(key, value))
return true;

if (!block_tree_db.ReadSpentIndex(key, value))
return error("Unable to get spend information");

return true;
return block_tree_db.ReadSpentIndex(key, value);
}

bool GetTimestampIndex(CBlockTreeDB& block_tree_db, const uint32_t high, const uint32_t low,
Expand All @@ -99,8 +92,5 @@ bool GetTimestampIndex(CBlockTreeDB& block_tree_db, const uint32_t high, const u
throw JSONRPCError(RPC_INVALID_REQUEST, "Timestamp index is disabled. You should run Dash Core with -timestampindex (requires reindex)");
}

if (!block_tree_db.ReadTimestampIndex(high, low, hashes))
return error("Unable to get hashes for timestamps");

return true;
return block_tree_db.ReadTimestampIndex(high, low, hashes);
}
Loading