From c944fd1d3a0b4c6acb45542036beae6f848fc6dd Mon Sep 17 00:00:00 2001 From: piercetrey-figure Date: Wed, 15 Nov 2023 13:43:12 -0700 Subject: [PATCH] bypass faux block mode polling on sync checktx failure - otherwise, timeout has to be hit and exception is thrown vs. initial error returned --- .../io/provenance/client/coroutines/PbCoroutinesClient.kt | 2 +- .../main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client-coroutines/src/main/kotlin/io/provenance/client/coroutines/PbCoroutinesClient.kt b/client-coroutines/src/main/kotlin/io/provenance/client/coroutines/PbCoroutinesClient.kt index 5c6f0ca..9442d53 100644 --- a/client-coroutines/src/main/kotlin/io/provenance/client/coroutines/PbCoroutinesClient.kt +++ b/client-coroutines/src/main/kotlin/io/provenance/client/coroutines/PbCoroutinesClient.kt @@ -172,7 +172,7 @@ open class PbCoroutinesClient( .setMode(actualMode) .build() ).let { res -> - if (simulateBlock) { + if (simulateBlock && res.txResponse.code == 0) { val timeoutHeight = providedTimeoutHeight.takeIf { it > 0 } ?: (latestHeight() + 10) // default to 10 block timeout for polling if no height set val txHash = res.txResponse.txhash do { diff --git a/client/src/main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt b/client/src/main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt index d8ddb33..1f2aed8 100644 --- a/client/src/main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt +++ b/client/src/main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt @@ -213,7 +213,7 @@ open class AbstractPbClient>( .setMode(actualMode) .build() ).let { res -> - if (simulateBlock) { + if (simulateBlock && res.txResponse.code == 0) { val timeoutHeight = providedTimeoutHeight.takeIf { it > 0 } ?: (latestHeight() + 10) // default to 10 block timeout for polling if no height set val txHash = res.txResponse.txhash do {