@@ -61,7 +61,7 @@ const (
6161 maxTxUnderpricedSetSize = 32768
6262
6363 // maxTxUnderpricedTimeout is the max time a transaction should be stuck in the underpriced set.
64- maxTxUnderpricedTimeout = int64 ( 5 * time .Minute )
64+ maxTxUnderpricedTimeout = 5 * time .Minute
6565
6666 // txArriveTimeout is the time allowance before an announced transaction is
6767 // explicitly requested.
@@ -167,7 +167,7 @@ type TxFetcher struct {
167167 drop chan * txDrop
168168 quit chan struct {}
169169
170- underpriced * lru.Cache [common.Hash , int64 ] // Transactions discarded as too cheap (don't re-fetch)
170+ underpriced * lru.Cache [common.Hash , time. Time ] // Transactions discarded as too cheap (don't re-fetch)
171171
172172 // Stage 1: Waiting lists for newly discovered transactions that might be
173173 // broadcast without needing explicit request/reply round trips.
@@ -222,7 +222,7 @@ func NewTxFetcherForTests(
222222 fetching : make (map [common.Hash ]string ),
223223 requests : make (map [string ]* txRequest ),
224224 alternates : make (map [common.Hash ]map [string ]struct {}),
225- underpriced : lru.NewCache [common.Hash , int64 ](maxTxUnderpricedSetSize ),
225+ underpriced : lru.NewCache [common.Hash , time. Time ](maxTxUnderpricedSetSize ),
226226 hasTx : hasTx ,
227227 addTxs : addTxs ,
228228 fetchTxs : fetchTxs ,
@@ -284,7 +284,7 @@ func (f *TxFetcher) Notify(peer string, types []byte, sizes []uint32, hashes []c
284284// isKnownUnderpriced reports whether a transaction hash was recently found to be underpriced.
285285func (f * TxFetcher ) isKnownUnderpriced (hash common.Hash ) bool {
286286 prevTime , ok := f .underpriced .Peek (hash )
287- if ok && prevTime + maxTxUnderpricedTimeout < time .Now ().Unix ( ) {
287+ if ok && prevTime . Before ( time .Now ().Add ( - maxTxUnderpricedTimeout ) ) {
288288 f .underpriced .Remove (hash )
289289 return false
290290 }
@@ -335,7 +335,7 @@ func (f *TxFetcher) Enqueue(peer string, txs []*types.Transaction, direct bool)
335335 // Avoid re-request this transaction when we receive another
336336 // announcement.
337337 if errors .Is (err , txpool .ErrUnderpriced ) || errors .Is (err , txpool .ErrReplaceUnderpriced ) {
338- f .underpriced .Add (batch [j ].Hash (), batch [j ].Time (). Unix () )
338+ f .underpriced .Add (batch [j ].Hash (), batch [j ].Time ())
339339 }
340340 // Track a few interesting failure types
341341 switch {
0 commit comments