mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-11 13:43:29 +01:00
wallet2: add remove_obsolete_pool_txs()
This commit is contained in:
parent
2c6aad7ea7
commit
288d3c75c3
@ -1516,6 +1516,34 @@ void wallet2::pull_next_blocks(uint64_t start_height, uint64_t &blocks_start_hei
|
|||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wallet2::remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashes)
|
||||||
|
{
|
||||||
|
// remove pool txes to us that aren't in the pool anymore
|
||||||
|
std::unordered_map<crypto::hash, wallet2::payment_details>::iterator uit = m_unconfirmed_payments.begin();
|
||||||
|
while (uit != m_unconfirmed_payments.end())
|
||||||
|
{
|
||||||
|
const crypto::hash &txid = uit->second.m_tx_hash;
|
||||||
|
bool found = false;
|
||||||
|
for (const auto &it2: tx_hashes)
|
||||||
|
{
|
||||||
|
if (it2 == txid)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto pit = uit++;
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
MDEBUG("Removing " << txid << " from unconfirmed payments, not found in pool");
|
||||||
|
m_unconfirmed_payments.erase(pit);
|
||||||
|
if (0 != m_callback)
|
||||||
|
m_callback->on_pool_tx_removed(txid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::update_pool_state(bool refreshed)
|
void wallet2::update_pool_state(bool refreshed)
|
||||||
{
|
{
|
||||||
@ -1593,28 +1621,8 @@ void wallet2::update_pool_state(bool refreshed)
|
|||||||
// the in transfers list instead (or nowhere if it just
|
// the in transfers list instead (or nowhere if it just
|
||||||
// disappeared without being mined)
|
// disappeared without being mined)
|
||||||
if (refreshed)
|
if (refreshed)
|
||||||
{
|
remove_obsolete_pool_txs(res.tx_hashes);
|
||||||
std::unordered_map<crypto::hash, wallet2::payment_details>::iterator uit = m_unconfirmed_payments.begin();
|
|
||||||
while (uit != m_unconfirmed_payments.end())
|
|
||||||
{
|
|
||||||
const crypto::hash &txid = uit->second.m_tx_hash;
|
|
||||||
bool found = false;
|
|
||||||
for (const auto &it2: res.tx_hashes)
|
|
||||||
{
|
|
||||||
if (it2 == txid)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auto pit = uit++;
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
MDEBUG("Removing " << txid << " from unconfirmed payments, not found in pool");
|
|
||||||
m_unconfirmed_payments.erase(pit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MDEBUG("update_pool_state done second loop");
|
MDEBUG("update_pool_state done second loop");
|
||||||
|
|
||||||
// gather txids of new pool txes to us
|
// gather txids of new pool txes to us
|
||||||
|
@ -696,6 +696,7 @@ namespace tools
|
|||||||
uint64_t import_key_images(const std::string &filename, uint64_t &spent, uint64_t &unspent);
|
uint64_t import_key_images(const std::string &filename, uint64_t &spent, uint64_t &unspent);
|
||||||
|
|
||||||
void update_pool_state(bool refreshed = false);
|
void update_pool_state(bool refreshed = false);
|
||||||
|
void remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashes);
|
||||||
|
|
||||||
std::string encrypt(const std::string &plaintext, const crypto::secret_key &skey, bool authenticated = true) const;
|
std::string encrypt(const std::string &plaintext, const crypto::secret_key &skey, bool authenticated = true) const;
|
||||||
std::string encrypt_with_view_secret_key(const std::string &plaintext, bool authenticated = true) const;
|
std::string encrypt_with_view_secret_key(const std::string &plaintext, bool authenticated = true) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user