fix wallet syncing

This commit is contained in:
undeath 2018-07-14 19:44:23 +02:00
parent 747c227762
commit 34f8600996
6 changed files with 13 additions and 7 deletions

View file

@ -985,8 +985,8 @@ def wallet_tool_main(wallet_root_path):
# unconfirmed balance is included in the wallet display by default
if 'listunspent_args' not in jm_single().config.options('POLICY'):
jm_single().config.set('POLICY','listunspent_args', '[0]')
sync_wallet(wallet, fast=options.fastsync)
wallet.save()
while not jm_single().bc_interface.wallet_synced:
sync_wallet(wallet, fast=options.fastsync)
#Now the wallet/data is prepared, execute the script according to the method
if method == "display":
return wallet_display(wallet, options.gaplimit, options.showprivkey)

View file

@ -240,7 +240,9 @@ def ygmain(ygclass, txfee=1000, cjfee_a=200, cjfee_r=0.002, ordertype='swreloffe
if jm_single().config.get("BLOCKCHAIN", "blockchain_source") == "electrum-server":
jm_single().bc_interface.synctype = "with-script"
sync_wallet(wallet, fast=options.fastsync)
while not jm_single().bc_interface.wallet_synced:
sync_wallet(wallet, fast=options.fastsync)
maker = ygclass(wallet, [options.txfee, cjfee_a, cjfee_r,
options.ordertype, options.minsize])

View file

@ -176,7 +176,8 @@ def main():
if options.loadwallet:
wallet_path = get_wallet_path(options.loadwallet, None)
wallet = open_wallet(wallet_path, gap_limit=options.gaplimit)
sync_wallet(wallet, fast=options.fastsync)
while not jm_single().bc_interface.wallet_synced:
sync_wallet(wallet, fast=options.fastsync)
for md, utxos in wallet.get_utxos_by_mixdepth_().items():
for (txid, index), utxo in utxos.items():

View file

@ -84,7 +84,8 @@ def cli_get_wallet(wallet_name, sync=True):
"blockchain_source") == "electrum-server":
jm_single().bc_interface.synctype = "with-script"
if sync:
sync_wallet(wallet, fast=options.fastsync)
while not jm_single().bc_interface.wallet_synced:
sync_wallet(wallet, fast=options.fastsync)
return wallet
#======Electrum specific utils=========================

View file

@ -134,7 +134,8 @@ def main():
"blockchain_source") == "electrum-server" and options.makercount != 0:
jm_single().bc_interface.synctype = "with-script"
#wallet sync will now only occur on reactor start if we're joining.
sync_wallet(wallet, fast=options.fastsync)
while not jm_single().bc_interface.wallet_synced:
sync_wallet(wallet, fast=options.fastsync)
if options.makercount == 0:
direct_send(wallet, amount, mixdepth, destaddr, options.answeryes)
return

View file

@ -38,7 +38,8 @@ def main():
if jm_single().config.get("BLOCKCHAIN",
"blockchain_source") == "electrum-server":
jm_single().bc_interface.synctype = "with-script"
sync_wallet(wallet, fast=options['fastsync'])
while not jm_single().bc_interface.wallet_synced:
sync_wallet(wallet, fast=options['fastsync'])
#Parse options and generate schedule
#Output information to log files