@@ -124,7 +124,7 @@ pub struct MempoolStore {
124124 // and doesn't free the memory when an item is removed - it's only replaced with a tombstone.
125125 // Since TxMempoolEntry is relatively big (size_of = 350+ bytes), we'd waste a noticeable
126126 // amount of memory without boxing.)
127- pub txs_by_id : TrackedHashMap < Id < Transaction > , Tracked < Box < TxMempoolEntry > , StrictDropPolicy > > ,
127+ txs_by_id : TrackedHashMap < Id < Transaction > , Tracked < Box < TxMempoolEntry > , StrictDropPolicy > > ,
128128
129129 // Mempool entries sorted by descendant score.
130130 // We keep this index so that when the mempool grows full, we know which transactions are the
@@ -136,22 +136,22 @@ pub struct MempoolStore {
136136 // max(fee/size of entry's tx, fee/size with all descendants).
137137 // TODO if we wish to follow Bitcoin Core, "size" is not simply the encoded size, but
138138 // rather a value that takes into account witness and sigop data (see CTxMemPoolEntry::GetTxSize).
139- pub txs_by_descendant_score : TrackedTxIdMultiMap < DescendantScore > ,
139+ txs_by_descendant_score : TrackedTxIdMultiMap < DescendantScore > ,
140140
141141 // Mempool entries sorted by ancestor score.
142142 // This is used to select the most economically attractive transactions for block production.
143143 // The ancestor score of an entry is defined as
144144 // min(fee/size of entry's tx, fee/size with all ancestors).
145- pub txs_by_ancestor_score : TrackedTxIdMultiMap < AncestorScore > ,
145+ txs_by_ancestor_score : TrackedTxIdMultiMap < AncestorScore > ,
146146
147147 // Entries that have remained in the mempool for a long time (see DEFAULT_MEMPOOL_EXPIRY) are
148148 // evicted. To efficiently know which entries to evict, we store the mempool entries sorted by
149149 // their creation time, from earliest to latest.
150- pub txs_by_creation_time : TrackedTxIdMultiMap < Time > ,
150+ txs_by_creation_time : TrackedTxIdMultiMap < Time > ,
151151
152152 // We keep the information of which inputs are spent by entries currently in the mempool.
153153 // This allows us to recognize conflicts (double-spends) and handle them
154- pub spender_txs : Tracked < BTreeMap < TxDependency , Id < Transaction > > > ,
154+ spender_txs : Tracked < BTreeMap < TxDependency , Id < Transaction > > > ,
155155
156156 // Track transactions by internal unique sequence number. This is used to recover the order in
157157 // which the transactions have been inserted into the mempool, so they can be re-inserted in
@@ -243,6 +243,29 @@ impl MempoolStore {
243243 self . mem_tracker . get_usage ( )
244244 }
245245
246+ pub fn txs_by_id (
247+ & self ,
248+ ) -> & TrackedHashMap < Id < Transaction > , Tracked < Box < TxMempoolEntry > , StrictDropPolicy > > {
249+ & self . txs_by_id
250+ }
251+
252+ pub fn txs_by_descendant_score ( & self ) -> & TrackedTxIdMultiMap < DescendantScore > {
253+ & self . txs_by_descendant_score
254+ }
255+
256+ pub fn txs_by_ancestor_score ( & self ) -> & TrackedTxIdMultiMap < AncestorScore > {
257+ & self . txs_by_ancestor_score
258+ }
259+
260+ pub fn txs_by_creation_time ( & self ) -> & TrackedTxIdMultiMap < Time > {
261+ & self . txs_by_creation_time
262+ }
263+
264+ #[ cfg( test) ]
265+ pub fn seq_nos_by_tx ( & self ) -> & TrackedHashMap < Id < Transaction > , usize > {
266+ & self . seq_nos_by_tx
267+ }
268+
246269 pub fn assert_valid ( & self ) {
247270 #[ cfg( test) ]
248271 self . assert_valid_inner ( )
0 commit comments