File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,27 @@ func (self *TxPool) AddTransactions(txs []*types.Transaction) {
204
204
}
205
205
}
206
206
207
+ // GetTransaction allows you to check the pending and queued transaction in the
208
+ // transaction pool.
209
+ // It has two stategies, first check the pool (map) then check the queue
210
+ func (tp * TxPool ) GetTransaction (hash common.Hash ) * types.Transaction {
211
+ // check the txs first
212
+ if tx , ok := tp .txs [hash ]; ok {
213
+ return tx
214
+ }
215
+
216
+ // check queue
217
+ for _ , txs := range tp .queue {
218
+ for _ , tx := range txs {
219
+ if tx .Hash () == hash {
220
+ return tx
221
+ }
222
+ }
223
+ }
224
+
225
+ return nil
226
+ }
227
+
207
228
func (self * TxPool ) GetTransactions () (txs types.Transactions ) {
208
229
self .mu .RLock ()
209
230
defer self .mu .RUnlock ()
You can’t perform that action at this time.
0 commit comments