Browse Source

Don't start maker with only expired-timelock utxos

Fixes #1314.
Prior to this commit, an attempt to start a maker bot which only
contained coins that were expired timelocked utxos (i.e. spendable),
in the RPC would result in the maker service starting but failing to
create offers. Instead, we want the maker service to not start as there
are no coins actually available for it.
master
Adam Gibson 3 years ago
parent
commit
904cb350b7
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 13
      jmclient/jmclient/wallet_rpc.py

13
jmclient/jmclient/wallet_rpc.py

@ -25,7 +25,7 @@ from jmclient import Taker, jm_single, \
NotEnoughFundsException, get_tumble_log, get_tumble_schedule, \
get_schedule, get_tumbler_parser, schedule_to_text, \
tumbler_filter_orders_callback, tumbler_taker_finished_update, \
validate_address
validate_address, FidelityBondMixin
from jmbase.support import get_log, utxostr_to_utxo
jlog = get_log()
@ -702,6 +702,17 @@ class JMWalletDaemon(Service):
# of the service (and therefore the startup) from
# proceeding:
raise NotEnoughCoinsForMaker()
# We must also not start if the only coins available are of
# the TL type *even* if the TL is expired. This check is done
# here early, as above, to avoid the maker service starting.
utxos = self.services["wallet"].get_all_utxos()
# remove any TL type:
utxos = [u for u in utxos.values() if not \
FidelityBondMixin.is_timelocked_path(u["path"])]
# Note that only the following check is required since we
# already checked that balance is non-zero.
if len(utxos) == 0:
raise NotEnoughCoinsForMaker()
self.services["maker"].addCleanup(cleanup)
# order of addition of service setup functions matters;

Loading…
Cancel
Save