mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
rpc: extend error-on-failure to GetSpentIndex
This commit is contained in:
parent
9a6503d9e8
commit
488f0474a8
@ -14,10 +14,10 @@ bool GetAddressIndex(const uint160& addressHash, const AddressType type,
|
|||||||
const int32_t start, const int32_t end)
|
const int32_t start, const int32_t end)
|
||||||
{
|
{
|
||||||
if (!fAddressIndex)
|
if (!fAddressIndex)
|
||||||
return error("address index not enabled");
|
return error("Address index not enabled");
|
||||||
|
|
||||||
if (!pblocktree->ReadAddressIndex(addressHash, type, addressIndex, start, end))
|
if (!pblocktree->ReadAddressIndex(addressHash, type, addressIndex, start, end))
|
||||||
return error("unable to get txids for address");
|
return error("Unable to get txids for address");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -26,10 +26,10 @@ bool GetAddressUnspentIndex(const uint160& addressHash, const AddressType type,
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue>>& unspentOutputs)
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue>>& unspentOutputs)
|
||||||
{
|
{
|
||||||
if (!fAddressIndex)
|
if (!fAddressIndex)
|
||||||
return error("address index not enabled");
|
return error("Address index not enabled");
|
||||||
|
|
||||||
if (!pblocktree->ReadAddressUnspentIndex(addressHash, type, unspentOutputs))
|
if (!pblocktree->ReadAddressUnspentIndex(addressHash, type, unspentOutputs))
|
||||||
return error("unable to get txids for address");
|
return error("Unable to get txids for address");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -37,13 +37,13 @@ bool GetAddressUnspentIndex(const uint160& addressHash, const AddressType type,
|
|||||||
bool GetSpentIndex(const CTxMemPool& mempool, const CSpentIndexKey& key, CSpentIndexValue& value)
|
bool GetSpentIndex(const CTxMemPool& mempool, const CSpentIndexKey& key, CSpentIndexValue& value)
|
||||||
{
|
{
|
||||||
if (!fSpentIndex)
|
if (!fSpentIndex)
|
||||||
return false;
|
return error("Spent index not enabled");
|
||||||
|
|
||||||
if (mempool.getSpentIndex(key, value))
|
if (mempool.getSpentIndex(key, value))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!pblocktree->ReadSpentIndex(key, value))
|
if (!pblocktree->ReadSpentIndex(key, value))
|
||||||
return false;
|
return error("Unable to get spend information");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user