mitigate Eth1Monitor being nil in merge scenario (#3600)

This commit is contained in:
tersec 2022-04-26 09:25:19 +00:00 committed by GitHub
parent 09b2f4c237
commit 0d5bbbc405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -449,7 +449,7 @@ proc getPayload*(p: Eth1Monitor,
payloadId: bellatrix.PayloadID): Future[engine_api.ExecutionPayloadV1] =
# Eth1 monitor can recycle connections without (external) warning; at least,
# don't crash.
if p.dataProvider.isNil:
if p.isNil or p.dataProvider.isNil:
var epr: Future[engine_api.ExecutionPayloadV1]
epr.complete(default(engine_api.ExecutionPayloadV1))
return epr
@ -472,7 +472,7 @@ proc forkchoiceUpdated*(p: Eth1Monitor,
Future[engine_api.ForkchoiceUpdatedResponse] =
# Eth1 monitor can recycle connections without (external) warning; at least,
# don't crash.
if p.dataProvider.isNil:
if p.isNil or p.dataProvider.isNil:
var fcuR: Future[engine_api.ForkchoiceUpdatedResponse]
fcuR.complete(engine_api.ForkchoiceUpdatedResponse(
payloadStatus: PayloadStatusV1(status: PayloadExecutionStatus.syncing)))
@ -498,7 +498,7 @@ proc forkchoiceUpdated*(p: Eth1Monitor,
Future[engine_api.ForkchoiceUpdatedResponse] =
# Eth1 monitor can recycle connections without (external) warning; at least,
# don't crash.
if p.dataProvider.isNil:
if p.isNil or p.dataProvider.isNil:
var fcuR: Future[engine_api.ForkchoiceUpdatedResponse]
fcuR.complete(engine_api.ForkchoiceUpdatedResponse(
payloadStatus: PayloadStatusV1(status: PayloadExecutionStatus.syncing)))