Skip to content

Commit f91fe56

Browse files
committed
Redo fix #4588
1 parent 89dcced commit f91fe56

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

beacon_chain/eth1/eth1_monitor.nim

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,8 +1819,18 @@ proc stop(m: ELManager) {.async.} =
18191819
const
18201820
votedBlocksSafetyMargin = 50
18211821

1822-
func earliestBlockOfInterest(m: ELManager, latestEth1BlockNumber: Eth1BlockNumber): Eth1BlockNumber =
1823-
latestEth1BlockNumber - (2 * m.cfg.ETH1_FOLLOW_DISTANCE) - votedBlocksSafetyMargin
1822+
func earliestBlockOfInterest(
1823+
m: ELManager,
1824+
latestEth1BlockNumber: Eth1BlockNumber): Eth1BlockNumber =
1825+
let blocksOfInterestRange =
1826+
SLOTS_PER_ETH1_VOTING_PERIOD +
1827+
(2 * m.cfg.ETH1_FOLLOW_DISTANCE) +
1828+
votedBlocksSafetyMargin
1829+
1830+
if latestEth1BlockNumber > blocksOfInterestRange:
1831+
latestEth1BlockNumber - blocksOfInterestRange
1832+
else:
1833+
0
18241834

18251835
proc syncBlockRange(m: ELManager,
18261836
connection: ELConnection,

0 commit comments

Comments
 (0)