From 90e0694d2e45a0315a76cc266cd33582c12c9848 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 17 Oct 2018 16:07:30 -0300 Subject: [PATCH] fix download from peer script --- scripts/download_blob_from_peer.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/download_blob_from_peer.py b/scripts/download_blob_from_peer.py index 210666972..93f1b8d13 100644 --- a/scripts/download_blob_from_peer.py +++ b/scripts/download_blob_from_peer.py @@ -7,13 +7,16 @@ import time import shutil from pprint import pprint -from twisted.internet import defer, reactor, threads +from twisted.internet import asyncioreactor +asyncioreactor.install() +from twisted.internet import defer, threads, reactor from lbrynet import conf from lbrynet.core import log_support, Peer from lbrynet.core.SinglePeerDownloader import SinglePeerDownloader from lbrynet.core.StreamDescriptor import BlobStreamDescriptorReader from lbrynet.core.BlobManager import DiskBlobManager +from lbrynet.daemon.Components import f2d from lbrynet.database.storage import SQLiteStorage from lbrynet.wallet.manager import LbryWalletManager @@ -51,12 +54,11 @@ def download_it(peer, timeout, blob_hash): tmp_blob_manager = DiskBlobManager(tmp_dir, storage) config = {'auto_connect': True} - if conf.settings['lbryum_wallet_dir']: - config['lbryum_wallet_dir'] = conf.settings['lbryum_wallet_dir'] - config['use_keyring'] = False - config['blockchain_name'] = conf.settings['blockchain_name'] - config['lbryum_servers'] = [] - wallet = LbryWalletManager.from_lbrynet_config(config, storage) + config['lbryum_wallet_dir'] = tempfile.mkdtemp() + config['use_keyring'] = False + config['blockchain_name'] = conf.settings['blockchain_name'] + config['lbryum_servers'] = [] + wallet = yield f2d(LbryWalletManager.from_lbrynet_config(config, storage)) downloader = SinglePeerDownloader() downloader.setup(wallet)