Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.h
Show First 20 Lines • Show All 551 Lines • ▼ Show 20 Lines | public: | ||||
* This mutex needs to be locked when accessing `mapTx` or other members | * This mutex needs to be locked when accessing `mapTx` or other members | ||||
* that are guarded by it. | * that are guarded by it. | ||||
* | * | ||||
* @par Consistency guarantees | * @par Consistency guarantees | ||||
* | * | ||||
* By design, it is guaranteed that: | * By design, it is guaranteed that: | ||||
* | * | ||||
* 1. Locking both `cs_main` and `mempool.cs` will give a view of mempool | * 1. Locking both `cs_main` and `mempool.cs` will give a view of mempool | ||||
* that is consistent with current chain tip (`::ChainActive()` and | * that is consistent with current chain tip (`ActiveChain()` and | ||||
* `CoinsTip()`) and is fully populated. Fully populated means that if | * `CoinsTip()`) and is fully populated. Fully populated means that if | ||||
* the current active chain is missing transactions that were present in a | * the current active chain is missing transactions that were present in | ||||
* previously active chain, all the missing transactions will have been | * a previously active chain, all the missing transactions will have been | ||||
* re-added to the mempool and should be present if they meet size and | * re-added to the mempool and should be present if they meet size and | ||||
* consistency constraints. | * consistency constraints. | ||||
* | * | ||||
* 2. Locking `mempool.cs` without `cs_main` will give a view of a mempool | * 2. Locking `mempool.cs` without `cs_main` will give a view of a mempool | ||||
* consistent with some chain that was active since `cs_main` was last | * consistent with some chain that was active since `cs_main` was last | ||||
* locked, and that is fully populated as described above. It is ok for | * locked, and that is fully populated as described above. It is ok for | ||||
* code that only needs to query or remove transactions from the mempool | * code that only needs to query or remove transactions from the mempool | ||||
* to lock just `mempool.cs` without `cs_main`. | * to lock just `mempool.cs` without `cs_main`. | ||||
▲ Show 20 Lines • Show All 485 Lines • Show Last 20 Lines |