From 1e1b03d097f14f231db6f9da4906626f4b53a79a Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Fri, 6 Dec 2019 16:09:00 +0000 Subject: [PATCH] Don't allow receive-payjoin start up without coins Fixes #459. If the mixdepth chosen is empty, shutdown immediately with ARGERROR. User can either choose a different mixdepth and try again, or receive payment another way. --- scripts/receive-payjoin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/receive-payjoin.py b/scripts/receive-payjoin.py index 63bd178..3da205d 100644 --- a/scripts/receive-payjoin.py +++ b/scripts/receive-payjoin.py @@ -77,6 +77,12 @@ def receive_payjoin_main(makerclass): while not wallet_service.synced: wallet_service.sync_wallet(fast=not options.recoversync) wallet_service.startService() + # having enforced wallet sync, we can check if we have coins + # to do payjoin in the mixdepth + if wallet_service.get_balance_by_mixdepth()[options.mixdepth] == 0: + jlog.error("Cannot do payjoin from mixdepth " + str( + options.mixdepth) + ", no coins. Shutting down.") + sys.exit(EXIT_ARGERROR) maker = makerclass(wallet_service, options.mixdepth, receiving_amount)