1
0
Fork 0
forked from lthn/blockchain

wallet2: minor cleaning up

This commit is contained in:
sowle 2019-05-08 16:59:09 +02:00
parent 36ef5b2a85
commit 6894f15e62

View file

@ -2110,14 +2110,6 @@ uint64_t wallet2::balance(uint64_t& unlocked, uint64_t& awaiting_in, uint64_t& a
awaiting_out = 0;
mined = 0;
// struct pos_coinbase_tx_t
// {
// pos_coinbase_tx_t() : tx(nullptr), unspent_sum(0) {}
// const currency::transaction* tx;
// uint64_t unspent_sum;
// };
// std::unordered_map<crypto::hash, pos_coinbase_tx_t> pos_coinbase_txs;
for(auto& td : m_transfers)
{
if (td.is_spendable() || td.is_reserved_for_escrow())
@ -2127,28 +2119,9 @@ uint64_t wallet2::balance(uint64_t& unlocked, uint64_t& awaiting_in, uint64_t& a
unlocked += td.amount();
if (td.m_flags & WALLET_TRANSFER_DETAIL_FLAG_MINED_TRANSFER)
mined += td.amount();
// bool pos_coinbase = false;
// if (is_coinbase(td.m_ptx_wallet_info->m_tx, pos_coinbase))
// mined += td.amount();
// if (pos_coinbase)
// {
// auto& el = pos_coinbase_txs[get_transaction_hash(td.m_ptx_wallet_info->m_tx)];
// el.tx = &td.m_ptx_wallet_info->m_tx;
// el.unspent_sum += td.amount();
// }
}
}
// for(auto pt : pos_coinbase_txs)
// {
// uint64_t mined_prev = mined;
// THROW_IF_FALSE_WALLET_INT_ERR_EX(pt.second.tx->vin.size() == 2, "Invalid coinbase tx in the container");
// uint64_t coinbase_stake_amount = boost::get<txin_to_key>(pt.second.tx->vin[1]).amount;
// if (coinbase_stake_amount <= pt.second.unspent_sum)
// mined -= coinbase_stake_amount;
// THROW_IF_FALSE_WALLET_INT_ERR_EX(mined <= mined_prev, "");
// }
for(auto& utx : m_unconfirmed_txs)
{
if (utx.second.is_income)
@ -2165,11 +2138,6 @@ uint64_t wallet2::balance(uint64_t& unlocked, uint64_t& awaiting_in, uint64_t& a
awaiting_out += utx.second.amount;
}
}
//collect escrow proposals change
// for (auto& exp: m_money_expirations)
// {
// balance_total += exp.change_amount;
// }
return balance_total;
}