Browse Source

Merge #1321: Don't start maker with only expired-timelock utxos

904cb35 Don't start maker with only expired-timelock utxos (Adam Gibson)
master
Adam Gibson 3 years ago
parent
commit
b0d41edbd6
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