From a5b49c313fdd1bf1875ce7a18cbf2fe9f56f0d9e Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 4 Apr 2023 23:20:07 -0700 Subject: [PATCH] added a maxTxArrivalWait constant to the fetcher. config params with longer durations than maxTxArrivalWait will default to the maxTxArrivalWait duration --- eth/fetcher/tx_fetcher.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eth/fetcher/tx_fetcher.go b/eth/fetcher/tx_fetcher.go index ad2ff13979..da6017b532 100644 --- a/eth/fetcher/tx_fetcher.go +++ b/eth/fetcher/tx_fetcher.go @@ -56,6 +56,10 @@ const ( // txGatherSlack is the interval used to collate almost-expired announces // with network fetches. txGatherSlack = 20 * time.Millisecond + + // maxTxArrivalWait is the longest acceptable duration for the txArrivalWait + // configuration value. Longer config values will default to this. + maxTxArrivalWait = 500 * time.Millisecond ) var ( @@ -337,6 +341,11 @@ func (f *TxFetcher) Start() { f.txArrivalWait = txGatherSlack } + // the txArrivalWait duration should not be greater than the maxTxArrivalWait duration + if f.txArrivalWait > maxTxArrivalWait { + f.txArrivalWait = maxTxArrivalWait + } + go f.loop() }