From 413a840c23f958bed0d98f53ec4fc132ccc46b0e Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Wed, 10 Jul 2024 09:00:45 -0600 Subject: [PATCH] return null when can't unpack to proposal --- .../kotlin/io/provenance/explorer/service/GovService.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/service/src/main/kotlin/io/provenance/explorer/service/GovService.kt b/service/src/main/kotlin/io/provenance/explorer/service/GovService.kt index 21b2727c..220eaa5f 100644 --- a/service/src/main/kotlin/io/provenance/explorer/service/GovService.kt +++ b/service/src/main/kotlin/io/provenance/explorer/service/GovService.kt @@ -3,6 +3,7 @@ package io.provenance.explorer.service import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.module.kotlin.readValue import com.google.protobuf.Any +import com.google.protobuf.InvalidProtocolBufferException import com.google.protobuf.util.JsonFormat import cosmos.gov.v1.Gov import cosmos.gov.v1.Gov.VoteOption @@ -783,7 +784,12 @@ private fun getUpgradePlanFromContentV1(record: GovProposalRecord): Upgrade.Plan } private fun getUpgradePlanFromDataV1beta1(record: GovProposalRecord): Upgrade.Plan? { - return record.dataV1beta1?.content?.toSoftwareUpgradeProposal()?.plan + return try { + record.dataV1beta1?.content?.toSoftwareUpgradeProposal()?.plan + } catch (e: InvalidProtocolBufferException) { + logger().error("unable to unpack ${record.dataV1beta1?.content} to SoftwareUpgradeProposal") + null + } } private fun processUpgradeProposalMessage(msg: Any): Upgrade.Plan? {