mirror of
https://github.com/monero-project/monero.git
synced 2025-05-10 09:34:59 -04:00
Merge pull request #1911
91d41090
tx_pool: ensure txes loaded from poolstate.bin have their txid cached (moneromooo-monero)aaeb164c
tx_pool: remove transactions if they're in the blockchain (moneromooo-monero)558cfc31
core, wallet: faster tx pool scanning (moneromooo-monero)f065234b
core: cache tx and block hashes in the respective classes (moneromooo-monero)
This commit is contained in:
commit
a73a886cb1
14 changed files with 312 additions and 109 deletions
|
@ -423,6 +423,13 @@ namespace cryptonote
|
|||
txs.push_back(tx_vt.second.tx);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
void tx_memory_pool::get_transaction_hashes(std::vector<crypto::hash>& txs) const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_transactions_lock);
|
||||
for(const auto& tx_vt: m_transactions)
|
||||
txs.push_back(get_transaction_hash(tx_vt.second.tx));
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
//TODO: investigate whether boolean return is appropriate
|
||||
bool tx_memory_pool::get_transactions_and_spent_keys_info(std::vector<tx_info>& tx_infos, std::vector<spent_key_image_info>& key_image_infos) const
|
||||
{
|
||||
|
@ -710,13 +717,22 @@ namespace cryptonote
|
|||
size_t n_removed = 0;
|
||||
size_t tx_size_limit = get_transaction_size_limit(version);
|
||||
for (auto it = m_transactions.begin(); it != m_transactions.end(); ) {
|
||||
bool remove = false;
|
||||
const crypto::hash &txid = get_transaction_hash(it->second.tx);
|
||||
if (it->second.blob_size >= tx_size_limit) {
|
||||
LOG_PRINT_L1("Transaction " << get_transaction_hash(it->second.tx) << " is too big (" << it->second.blob_size << " bytes), removing it from pool");
|
||||
LOG_PRINT_L1("Transaction " << txid << " is too big (" << it->second.blob_size << " bytes), removing it from pool");
|
||||
remove = true;
|
||||
}
|
||||
else if (m_blockchain.have_tx(txid)) {
|
||||
LOG_PRINT_L1("Transaction " << txid << " is in the blockchain, removing it from pool");
|
||||
remove = true;
|
||||
}
|
||||
if (remove) {
|
||||
remove_transaction_keyimages(it->second.tx);
|
||||
auto sorted_it = find_tx_in_sorted_container(it->first);
|
||||
auto sorted_it = find_tx_in_sorted_container(txid);
|
||||
if (sorted_it == m_txs_by_fee_and_receive_time.end())
|
||||
{
|
||||
LOG_PRINT_L1("Removing tx " << it->first << " from tx pool, but it was not found in the sorted txs container!");
|
||||
LOG_PRINT_L1("Removing tx " << txid << " from tx pool, but it was not found in the sorted txs container!");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue