core: catch exceptions from get_output_key
This can happen when trying to find an amount that does not exist, and fixes a core test.
This commit is contained in:
parent
5eef64578b
commit
3cabdb5ef2
|
@ -154,9 +154,17 @@ bool Blockchain::scan_outputkeys_for_indexes(const txin_to_key& tx_in_to_key, vi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
m_db->get_output_key(tx_in_to_key.amount, absolute_offsets, outputs);
|
m_db->get_output_key(tx_in_to_key.amount, absolute_offsets, outputs);
|
||||||
}
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
LOG_PRINT_L0("Output does not exist! amount = " << tx_in_to_key.amount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check for partial results and add the rest if needed;
|
// check for partial results and add the rest if needed;
|
||||||
|
@ -167,7 +175,15 @@ bool Blockchain::scan_outputkeys_for_indexes(const txin_to_key& tx_in_to_key, vi
|
||||||
std::vector<output_data_t> add_outputs;
|
std::vector<output_data_t> add_outputs;
|
||||||
for (size_t i = outputs.size(); i < absolute_offsets.size(); i++)
|
for (size_t i = outputs.size(); i < absolute_offsets.size(); i++)
|
||||||
add_offsets.push_back(absolute_offsets[i]);
|
add_offsets.push_back(absolute_offsets[i]);
|
||||||
|
try
|
||||||
|
{
|
||||||
m_db->get_output_key(tx_in_to_key.amount, add_offsets, add_outputs);
|
m_db->get_output_key(tx_in_to_key.amount, add_offsets, add_outputs);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
LOG_PRINT_L0("Output does not exist! amount = " << tx_in_to_key.amount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
outputs.insert(outputs.end(), add_outputs.begin(), add_outputs.end());
|
outputs.insert(outputs.end(), add_outputs.begin(), add_outputs.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue