@@ -61,7 +61,7 @@ const (
61
61
maxTxUnderpricedSetSize = 32768
62
62
63
63
// 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
65
65
66
66
// txArriveTimeout is the time allowance before an announced transaction is
67
67
// explicitly requested.
@@ -167,7 +167,7 @@ type TxFetcher struct {
167
167
drop chan * txDrop
168
168
quit chan struct {}
169
169
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)
171
171
172
172
// Stage 1: Waiting lists for newly discovered transactions that might be
173
173
// broadcast without needing explicit request/reply round trips.
@@ -222,7 +222,7 @@ func NewTxFetcherForTests(
222
222
fetching : make (map [common.Hash ]string ),
223
223
requests : make (map [string ]* txRequest ),
224
224
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 ),
226
226
hasTx : hasTx ,
227
227
addTxs : addTxs ,
228
228
fetchTxs : fetchTxs ,
@@ -284,7 +284,7 @@ func (f *TxFetcher) Notify(peer string, types []byte, sizes []uint32, hashes []c
284
284
// isKnownUnderpriced reports whether a transaction hash was recently found to be underpriced.
285
285
func (f * TxFetcher ) isKnownUnderpriced (hash common.Hash ) bool {
286
286
prevTime , ok := f .underpriced .Peek (hash )
287
- if ok && prevTime + maxTxUnderpricedTimeout < time .Now ().Unix ( ) {
287
+ if ok && prevTime . Before ( time .Now ().Add ( - maxTxUnderpricedTimeout ) ) {
288
288
f .underpriced .Remove (hash )
289
289
return false
290
290
}
@@ -335,7 +335,7 @@ func (f *TxFetcher) Enqueue(peer string, txs []*types.Transaction, direct bool)
335
335
// Avoid re-request this transaction when we receive another
336
336
// announcement.
337
337
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 ())
339
339
}
340
340
// Track a few interesting failure types
341
341
switch {
0 commit comments