aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/tx_pool.h
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-07-19 14:02:20 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-07-19 14:02:20 -0500
commit5cade9418944ad63a229be210bfa43ca180b7c94 (patch)
tree585a7621dfb2c6c63674f115e5d9cade2ca56ec7 /src/cryptonote_core/tx_pool.h
parentMerge pull request #4045 (diff)
parenttx_pool: cache check_tx_inputs results (diff)
downloadmonero-5cade9418944ad63a229be210bfa43ca180b7c94.tar.xz
Merge pull request #4047
41b4bf9 tx_pool: cache check_tx_inputs results (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core/tx_pool.h')
-rw-r--r--src/cryptonote_core/tx_pool.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h
index 5ccb71196..4ade7ddbe 100644
--- a/src/cryptonote_core/tx_pool.h
+++ b/src/cryptonote_core/tx_pool.h
@@ -499,12 +499,13 @@ namespace cryptonote
* @brief check if a transaction is a valid candidate for inclusion in a block
*
* @param txd the transaction to check (and info about it)
+ * @param txid the txid of the transaction to check
* @param txblob the transaction blob to check
* @param tx the parsed transaction, if successful
*
* @return true if the transaction is good to go, otherwise false
*/
- bool is_transaction_ready_to_go(txpool_tx_meta_t& txd, const cryptonote::blobdata &txblob, transaction &tx) const;
+ bool is_transaction_ready_to_go(txpool_tx_meta_t& txd, const crypto::hash &txid, const cryptonote::blobdata &txblob, transaction &tx) const;
/**
* @brief mark all transactions double spending the one passed
@@ -557,6 +558,9 @@ private:
*/
sorted_tx_container::iterator find_tx_in_sorted_container(const crypto::hash& id) const;
+ //! cache/call Blockchain::check_tx_inputs results
+ bool check_tx_inputs(const std::function<cryptonote::transaction&(void)> &get_tx, const crypto::hash &txid, uint64_t &max_used_block_height, crypto::hash &max_used_block_id, tx_verification_context &tvc, bool kept_by_block = false) const;
+
//! transactions which are unlikely to be included in blocks
/*! These transactions are kept in RAM in case they *are* included
* in a block eventually, but this container is not saved to disk.
@@ -567,6 +571,8 @@ private:
size_t m_txpool_max_size;
size_t m_txpool_size;
+
+ mutable std::unordered_map<crypto::hash, std::tuple<bool, tx_verification_context, uint64_t, crypto::hash>> m_input_cache;
};
}