resume EL sync at correct block on reconnect (#3957)

When connection to the EL is lost as part of EL deposits importing, the
targeted block range to sync would reset. This is changed to properly
remember import progress across reconnects.
This commit is contained in:
Etan Kissling 2022-08-12 15:48:33 +02:00 committed by GitHub
parent d07d7b1c48
commit 98a533c781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 10 deletions

View File

@ -1410,7 +1410,8 @@ proc startEth1Syncing(m: Eth1Monitor, delayBeforeStart: Duration) {.async.} =
let shouldProcessDeposits = not m.depositContractAddress.isZeroMemory
var eth1SyncedTo: Eth1BlockNumber
if shouldProcessDeposits and m.depositsChain.blocks.len == 0:
if shouldProcessDeposits:
if m.depositsChain.blocks.len == 0:
let startBlock = awaitWithRetries(
m.dataProvider.getBlockByHash(
m.depositsChain.finalizedBlockHash.asBlockHash))
@ -1420,14 +1421,14 @@ proc startEth1Syncing(m: Eth1Monitor, delayBeforeStart: Duration) {.async.} =
number: Eth1BlockNumber startBlock.number,
timestamp: Eth1BlockTimestamp startBlock.timestamp)
eth1SyncedTo = Eth1BlockNumber startBlock.number
eth1SyncedTo = Eth1BlockNumber m.depositsChain.blocks[^1].number
eth1_synced_head.set eth1SyncedTo.toGaugeValue
eth1_finalized_head.set eth1SyncedTo.toGaugeValue
eth1_finalized_deposits.set(
m.depositsChain.finalizedDepositsMerkleizer.getChunkCount.toGaugeValue)
debug "Starting Eth1 syncing", `from` = shortLog(m.depositsChain.blocks[0])
debug "Starting Eth1 syncing", `from` = shortLog(m.depositsChain.blocks[^1])
while true:
if bnStatus == BeaconNodeStatus.Stopping: