fixed crash on calling yield_info from new wallet
This commit is contained in:
@@ -2415,23 +2415,24 @@ bool wallet2::get_yield_summary_info(uint64_t &total_burnt,
|
|||||||
// Iterate over the transfers in our wallet
|
// Iterate over the transfers in our wallet
|
||||||
std::map<size_t, size_t> map_payouts;
|
std::map<size_t, size_t> map_payouts;
|
||||||
std::map<std::string, std::pair<size_t, std::pair<uint64_t, uint64_t>>> payouts_active;
|
std::map<std::string, std::pair<size_t, std::pair<uint64_t, uint64_t>>> payouts_active;
|
||||||
for (size_t idx = m_transfers.size()-1; idx>0; --idx) {
|
if (m_transfers.size() > 0) {
|
||||||
const tools::wallet2::transfer_details& td = m_transfers[idx];
|
for (size_t idx = m_transfers.size()-1; idx>0; --idx) {
|
||||||
//if (td.m_block_height < ybi_data[0].block_height) break;
|
const tools::wallet2::transfer_details& td = m_transfers[idx];
|
||||||
if (td.m_tx.type == cryptonote::transaction_type::STAKE) {
|
//if (td.m_block_height < ybi_data[0].block_height) break;
|
||||||
if (map_payouts.count(idx)) {
|
if (td.m_tx.type == cryptonote::transaction_type::STAKE) {
|
||||||
payouts.push_back(std::make_tuple(td.m_block_height, epee::string_tools::pod_to_hex(td.m_txid), td.m_tx.amount_burnt, m_transfers[map_payouts[idx]].m_amount - td.m_tx.amount_burnt));
|
if (map_payouts.count(idx)) {
|
||||||
} else {
|
payouts.push_back(std::make_tuple(td.m_block_height, epee::string_tools::pod_to_hex(td.m_txid), td.m_tx.amount_burnt, m_transfers[map_payouts[idx]].m_amount - td.m_tx.amount_burnt));
|
||||||
//payouts.push_back(std::make_tuple(td.m_block_height, epee::string_tools::pod_to_hex(td.m_txid), td.m_tx.amount_burnt, 0));
|
} else {
|
||||||
payouts_active[epee::string_tools::pod_to_hex(td.m_txid)] = std::make_pair(td.m_block_height, std::make_pair(td.m_tx.amount_burnt, 0));
|
//payouts.push_back(std::make_tuple(td.m_block_height, epee::string_tools::pod_to_hex(td.m_txid), td.m_tx.amount_burnt, 0));
|
||||||
|
payouts_active[epee::string_tools::pod_to_hex(td.m_txid)] = std::make_pair(td.m_block_height, std::make_pair(td.m_tx.amount_burnt, 0));
|
||||||
|
}
|
||||||
|
} else if (td.m_tx.type == cryptonote::transaction_type::PROTOCOL) {
|
||||||
|
// Store list of reverse-lookup indices to tell YIELD TXs how much they earned
|
||||||
|
if (m_transfers[td.m_td_origin_idx].m_tx.type == cryptonote::transaction_type::STAKE)
|
||||||
|
map_payouts[td.m_td_origin_idx] = idx;
|
||||||
}
|
}
|
||||||
} else if (td.m_tx.type == cryptonote::transaction_type::PROTOCOL) {
|
|
||||||
// Store list of reverse-lookup indices to tell YIELD TXs how much they earned
|
|
||||||
if (m_transfers[td.m_td_origin_idx].m_tx.type == cryptonote::transaction_type::STAKE)
|
|
||||||
map_payouts[td.m_td_origin_idx] = idx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Scan the entries we have received to gather the state (total yield over period captured)
|
// Scan the entries we have received to gather the state (total yield over period captured)
|
||||||
total_burnt = 0;
|
total_burnt = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user