From 7ab269a2407e0d721d0fce2d66db29d9cb122454 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Wed, 16 Nov 2022 12:42:52 +0100 Subject: [PATCH] fix: if a error is throws from bitcoind return the error to cln This is always true except for the get block by height Signed-off-by: Vincenzo Palazzo --- btcli4j-gen.sh | 2 +- compile_commands.json | 1 + .../btcli4j/control/commands/btcprune/GetChainInfoBtc.kt | 4 ++-- .../control/commands/btcprune/SendRawTransactionBtc.kt | 7 +++++-- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 compile_commands.json diff --git a/btcli4j-gen.sh b/btcli4j-gen.sh index 910c4bc..b830c18 100755 --- a/btcli4j-gen.sh +++ b/btcli4j-gen.sh @@ -1,4 +1,4 @@ #!/bin/bash # Script generated from gradle! By clightning4j -/usr/lib/jvm/jdk-11.0.10/bin/java -jar /home/vincent/Github/clightning4j/btcli4j/build/libs/btcli4j-all.jar \ No newline at end of file +/home/vincent/.jdks/azul-15.0.9/bin/java -jar /home/vincent/Github/clightning4j/btcli4j/build/libs/btcli4j-all.jar \ No newline at end of file diff --git a/compile_commands.json b/compile_commands.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/compile_commands.json @@ -0,0 +1 @@ +[] diff --git a/src/main/kotlin/io/vincenzopalazzo/btcli4j/control/commands/btcprune/GetChainInfoBtc.kt b/src/main/kotlin/io/vincenzopalazzo/btcli4j/control/commands/btcprune/GetChainInfoBtc.kt index b648d8f..81b2359 100644 --- a/src/main/kotlin/io/vincenzopalazzo/btcli4j/control/commands/btcprune/GetChainInfoBtc.kt +++ b/src/main/kotlin/io/vincenzopalazzo/btcli4j/control/commands/btcprune/GetChainInfoBtc.kt @@ -69,9 +69,9 @@ class GetChainInfoBtc( throw exception } catch (exception: Exception) { when (exception) { - /*is BitcoinCoreException -> { + is BitcoinCoreException -> { plugin.log(PluginLog.ERROR, "GetChainInfoBtc: terminate bitcoin core with error: %s".format(exception.message)) - }*/ + } is LiteBitcoinRPCException -> { plugin.log(PluginLog.ERROR, exception.stackTraceToString()) } diff --git a/src/main/kotlin/io/vincenzopalazzo/btcli4j/control/commands/btcprune/SendRawTransactionBtc.kt b/src/main/kotlin/io/vincenzopalazzo/btcli4j/control/commands/btcprune/SendRawTransactionBtc.kt index af4f99f..f3d90fe 100644 --- a/src/main/kotlin/io/vincenzopalazzo/btcli4j/control/commands/btcprune/SendRawTransactionBtc.kt +++ b/src/main/kotlin/io/vincenzopalazzo/btcli4j/control/commands/btcprune/SendRawTransactionBtc.kt @@ -60,13 +60,16 @@ class SendRawTransactionBtc(private val bitcoinRPC: LiteBitcoinRPC, private val when (exception) { is BitcoinCoreException -> { plugin.log(PluginLog.ERROR, "GetChainInfoBtc: terminate bitcoin core with error: %s".format(exception.message)) + response.apply { + add("errmsg", exception.message) + } } is LiteBitcoinRPCException -> { plugin.log(PluginLog.ERROR, exception.stackTraceToString()) + plugin.log(PluginLog.DEBUG, "SendRawTransactionBtc: Share message to esplora") + alternative.run(plugin, request, response) } } - plugin.log(PluginLog.DEBUG, "SendRawTransactionBtc: Share message to esplora") - alternative.run(plugin, request, response) } } }