From 36d0abe635dc51e5dfd44e53e2882683f97305b1 Mon Sep 17 00:00:00 2001 From: catbref Date: Wed, 5 Aug 2020 10:04:25 +0100 Subject: [PATCH] WIP: trade-bot: log warning when we can't fund P2SH-B for some reason --- src/main/java/org/qortal/controller/TradeBot.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/qortal/controller/TradeBot.java b/src/main/java/org/qortal/controller/TradeBot.java index db9f0f8d..afe5c5f6 100644 --- a/src/main/java/org/qortal/controller/TradeBot.java +++ b/src/main/java/org/qortal/controller/TradeBot.java @@ -654,6 +654,11 @@ public class TradeBot { String p2shAddress = BTC.getInstance().deriveP2shAddress(redeemScriptBytes); Transaction p2shFundingTransaction = BTC.getInstance().buildSpend(tradeBotData.getXprv58(), p2shAddress, FEE_AMOUNT); + if (p2shFundingTransaction == null) { + LOGGER.warn(() -> String.format("Unable to build P2SH-B funding transaction - lack of funds?")); + return; + } + if (!BTC.getInstance().broadcastTransaction(p2shFundingTransaction)) { // We couldn't fund P2SH-B at this time LOGGER.debug(() -> String.format("Couldn't broadcast P2SH-B funding transaction?"));