aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-03-22 20:26:56 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-03-23 09:25:33 +0000
commit91d410902399befd81589fd0153e5b7994bcdaa2 (patch)
treedc7ba63d34e1efd624628bd9a80f7387e74a382c /src
parenttx_pool: remove transactions if they're in the blockchain (diff)
downloadmonero-91d410902399befd81589fd0153e5b7994bcdaa2.tar.xz
tx_pool: ensure txes loaded from poolstate.bin have their txid cached
The txid is not saved, and we want to make sure the transactions have their txid cached while in the pool, since get_transactions copies the transaction object, so any txid calculation on those copies would not benefit any later caller, since the original tx would be left without a cached txid.
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/tx_pool.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp
index 93fe57232..cde97b52f 100644
--- a/src/cryptonote_core/tx_pool.cpp
+++ b/src/cryptonote_core/tx_pool.cpp
@@ -718,20 +718,21 @@ namespace cryptonote
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 " << it->first << " 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(it->first)) {
- LOG_PRINT_L1("Transaction " << it->first << " is in the blockchain, removing it from pool");
+ 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
{