Browse Source

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.
master
Adam Gibson 6 years ago
parent
commit
1e1b03d097
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 6
      scripts/receive-payjoin.py

6
scripts/receive-payjoin.py

@ -77,6 +77,12 @@ def receive_payjoin_main(makerclass):
while not wallet_service.synced: while not wallet_service.synced:
wallet_service.sync_wallet(fast=not options.recoversync) wallet_service.sync_wallet(fast=not options.recoversync)
wallet_service.startService() 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) maker = makerclass(wallet_service, options.mixdepth, receiving_amount)

Loading…
Cancel
Save