Fix race condition UNL data

This commit is contained in:
Wietse Wind
2023-10-29 02:26:21 +02:00
parent cb4d2950de
commit 575efccb02

View File

@@ -17,7 +17,7 @@ const onValidation = async ({
/**
* Only proceed if the pubkey is on preferred UNL & reported by node with expected network ID
*/
const validationHostInUnl = unlData.hosts.indexOf(validation.validation_public_key) > -1 && networkId === unlData.networkid
const validationHostInUnl = (unlData?.hosts || []).indexOf(validation.validation_public_key) > -1 && networkId === unlData.networkid
const storeAllValidations = process.env?.ONLYUNLVALIDATIONS
const validationLedgerIndex = Number(validation.ledger_index)