Skip to content

Commit

Permalink
return null when can't unpack to proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Jul 10, 2024
1 parent 6a03669 commit 413a840
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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? {
Expand Down

0 comments on commit 413a840

Please sign in to comment.