From 0ae232b8bac568af94dbb20f92a8fb34ad160f74 Mon Sep 17 00:00:00 2001 From: catbref Date: Fri, 29 May 2020 19:09:45 +0100 Subject: [PATCH] Fix return result from ElectrumX.broadcastTransaction --- src/main/java/org/qortal/crosschain/ElectrumX.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/qortal/crosschain/ElectrumX.java b/src/main/java/org/qortal/crosschain/ElectrumX.java index 95b3ecf4..41c3d99d 100644 --- a/src/main/java/org/qortal/crosschain/ElectrumX.java +++ b/src/main/java/org/qortal/crosschain/ElectrumX.java @@ -224,13 +224,13 @@ public class ElectrumX { } public boolean broadcastTransaction(byte[] transactionBytes) { - JSONObject broadcastJson = (JSONObject) this.rpc("blockchain.transaction.broadcast", HashCode.fromBytes(transactionBytes).toString()); - if (broadcastJson == null) + Object rawBroadcastResult = this.rpc("blockchain.transaction.broadcast", HashCode.fromBytes(transactionBytes).toString()); + if (rawBroadcastResult == null) return false; - // If JSON contains "result", then it went through ok. - // Otherwise JSON would contain "error" instead. - return broadcastJson.containsKey("result"); + // If result is a String, then it is simply transaction hash. + // Otherwise result is JSON and probably contains error info instead. + return rawBroadcastResult instanceof String; } // Class-private utility methods