automatically give LBC to users on the first run and update RUNNING.md for prompt interface
This commit is contained in:
parent
0891b0d294
commit
6252f903ee
6 changed files with 178 additions and 60 deletions
23
RUNNING.md
23
RUNNING.md
|
@ -8,7 +8,7 @@ Download the file https://raw.githubusercontent.com/lbryio/lbry-setup/master/lbr
|
||||||
|
|
||||||
Once it's done building, type:
|
Once it's done building, type:
|
||||||
|
|
||||||
./lbrycrd/src/lbrycrdd -server -daemon -gen
|
./lbrycrd/src/lbrycrdd -server -daemon
|
||||||
|
|
||||||
lbrynet-gui
|
lbrynet-gui
|
||||||
|
|
||||||
|
@ -91,12 +91,13 @@ In order to use lbrynet-console or lbrynet-gui, lbyrcrdd must be running.
|
||||||
|
|
||||||
If you ran the easy install script, the lbrycrd folder will be in the directory you ran lbry_setup.sh from. Otherwise it is the root of the cloned lbrycrd repository. Go to that directory.
|
If you ran the easy install script, the lbrycrd folder will be in the directory you ran lbry_setup.sh from. Otherwise it is the root of the cloned lbrycrd repository. Go to that directory.
|
||||||
|
|
||||||
|
./src/lbrycrdd -server -daemon
|
||||||
|
|
||||||
|
If you want to mine LBC, also use the flag '-gen', so:
|
||||||
|
|
||||||
./src/lbrycrdd -server -daemon -gen
|
./src/lbrycrdd -server -daemon -gen
|
||||||
|
|
||||||
It will take a few minutes for your client to download the whole block chain.
|
It will take a few minutes for your client to download the whole block chain.
|
||||||
Once it has caught up, it will start mining coins.
|
|
||||||
|
|
||||||
If you don't want to mine, leave off the '-gen' flag.
|
|
||||||
|
|
||||||
lbrycrdd must be running in order for lbrynet to function.
|
lbrycrdd must be running in order for lbrynet to function.
|
||||||
|
|
||||||
|
@ -112,19 +113,15 @@ In your terminal:
|
||||||
|
|
||||||
lbrynet-console
|
lbrynet-console
|
||||||
|
|
||||||
You should now be presented with a list of options.
|
You should be presented with a prompt.
|
||||||
|
|
||||||
Watch It's a Wonderful Life via LBRY
|
Watch It's a Wonderful Life via LBRY
|
||||||
|
|
||||||
Choose the option labeled Add a stream from a short name by typing the number next to it and pressing the enter key.
|
Type into the prompt:
|
||||||
|
|
||||||
You will be prompted for a name. Type in "wonderfullife" and hit enter. After a few seconds, you will prompted to choose what you want to do with the file. Select the option labeled Stream.
|
get wonderfullife
|
||||||
|
|
||||||
You will be shown some options related to the file which you do not care about. Type 'n' and hit enter.
|
To shut it down, type ctrl-c at any time or enter 'exit' into the prompt.
|
||||||
|
|
||||||
You will be prompted to choose if you really want to download this file. Type 'y' and hit enter.
|
|
||||||
|
|
||||||
To shut it down, type ctrl-c at any time or enter the option to shut down from the main menu.
|
|
||||||
|
|
||||||
### Option 2) Running lbrynet-gui
|
### Option 2) Running lbrynet-gui
|
||||||
|
|
||||||
|
@ -137,4 +134,4 @@ lbrynet-gui
|
||||||
A window should pop up with an entry box. Type 'wonderfullife' into the box, hit go, and then choose to save it or stream it.
|
A window should pop up with an entry box. Type 'wonderfullife' into the box, hit go, and then choose to save it or stream it.
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
|
||||||
Any questions or problems, email jimmy@lbry.io
|
Any questions or problems, email jimmy@lbry.io
|
||||||
|
|
|
@ -312,7 +312,7 @@ class LBRYcrdWallet(object):
|
||||||
|
|
||||||
def get_name_and_validity_for_sd_hash(self, sd_hash):
|
def get_name_and_validity_for_sd_hash(self, sd_hash):
|
||||||
d = self._get_claim_metadata_for_sd_hash(sd_hash)
|
d = self._get_claim_metadata_for_sd_hash(sd_hash)
|
||||||
d.addCallback(lambda name_txid: self._get_status_of_claim(name_txid[1], name_txid[0], sd_hash) if name_txid is not None else None)
|
d.addCallback(lambda name_txid: threads.deferToThread(self._get_status_of_claim, name_txid[1], name_txid[0], sd_hash) if name_txid is not None else None)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def get_available_balance(self):
|
def get_available_balance(self):
|
||||||
|
@ -321,6 +321,15 @@ class LBRYcrdWallet(object):
|
||||||
def get_new_address(self):
|
def get_new_address(self):
|
||||||
return threads.deferToThread(self._get_new_address)
|
return threads.deferToThread(self._get_new_address)
|
||||||
|
|
||||||
|
def check_first_run(self):
|
||||||
|
d = threads.deferToThread(self._get_wallet_balance)
|
||||||
|
d.addCallback(lambda bal: threads.deferToThread(self._get_num_addresses) if bal == 0 else 2)
|
||||||
|
d.addCallback(lambda num_addresses: True if num_addresses <= 1 else False)
|
||||||
|
return d
|
||||||
|
|
||||||
|
def get_most_recent_blocktime(self):
|
||||||
|
return threads.deferToThread(self._get_best_block_time)
|
||||||
|
|
||||||
def get_rpc_conf(self):
|
def get_rpc_conf(self):
|
||||||
settings = {"username": "rpcuser",
|
settings = {"username": "rpcuser",
|
||||||
"password": "rpcpassword",
|
"password": "rpcpassword",
|
||||||
|
@ -509,6 +518,20 @@ class LBRYcrdWallet(object):
|
||||||
return name, "unconfirmed"
|
return name, "unconfirmed"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@_catch_connection_error
|
||||||
|
def _get_num_addresses(self):
|
||||||
|
rpc_conn = self._get_rpc_conn()
|
||||||
|
return len(rpc_conn.getaddressesbyaccount(""))
|
||||||
|
|
||||||
|
@_catch_connection_error
|
||||||
|
def _get_best_block_time(self):
|
||||||
|
rpc_conn = self._get_rpc_conn()
|
||||||
|
best_block_hash = rpc_conn.getbestblockhash()
|
||||||
|
block = rpc_conn.getblock(best_block_hash)
|
||||||
|
if 'time' in block:
|
||||||
|
return block['time']
|
||||||
|
raise ValueError("Could not get a block time")
|
||||||
|
|
||||||
|
|
||||||
@_catch_connection_error
|
@_catch_connection_error
|
||||||
def _rpc_stop(self):
|
def _rpc_stop(self):
|
||||||
|
|
|
@ -12,6 +12,7 @@ from lbrynet.core.Error import UnknownNameError, InvalidBlobHashError, Insuffici
|
||||||
from lbrynet.core.Error import InvalidStreamInfoError
|
from lbrynet.core.Error import InvalidStreamInfoError
|
||||||
from lbrynet.core.utils import is_valid_blobhash
|
from lbrynet.core.utils import is_valid_blobhash
|
||||||
from twisted.internet import defer, threads
|
from twisted.internet import defer, threads
|
||||||
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
@ -2349,4 +2350,50 @@ class StatusFactory(CommandHandlerFactory):
|
||||||
"Show the list of files that are currently downloading " \
|
"Show the list of files that are currently downloading " \
|
||||||
"or have been downloaded, and give the option to " \
|
"or have been downloaded, and give the option to " \
|
||||||
"toggle whether the file is actively downloading or " \
|
"toggle whether the file is actively downloading or " \
|
||||||
"to remove the file."
|
"to remove the file."
|
||||||
|
|
||||||
|
|
||||||
|
class BlockchainStatus(CommandHandler):
|
||||||
|
def __init__(self, console, wallet=None):
|
||||||
|
CommandHandler.__init__(self, console)
|
||||||
|
self.wallet = wallet
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
d = self.wallet.get_most_recent_blocktime()
|
||||||
|
d.addCallbacks(self._show_time_behind_blockchain, self._show_error)
|
||||||
|
d.chainDeferred(self.finished_deferred)
|
||||||
|
return d
|
||||||
|
|
||||||
|
def _show_time_behind_blockchain(self, best_block_time):
|
||||||
|
best_time = datetime.datetime.utcfromtimestamp(best_block_time)
|
||||||
|
diff = datetime.datetime.utcnow() - best_time
|
||||||
|
unit = None
|
||||||
|
val = None
|
||||||
|
if diff.days > 0:
|
||||||
|
if diff.days >= 7:
|
||||||
|
val = diff.days // 7
|
||||||
|
unit = "week"
|
||||||
|
else:
|
||||||
|
val = diff.days
|
||||||
|
unit = "day"
|
||||||
|
elif diff.seconds >= 60 * 90:
|
||||||
|
if diff.seconds >= 60 * 60:
|
||||||
|
val = diff.seconds // (60 * 60)
|
||||||
|
unit = "hour"
|
||||||
|
if unit is not None:
|
||||||
|
if val != 1:
|
||||||
|
unit += "s"
|
||||||
|
self.console.sendLine("This application is %d %s behind the LBC blockchain." % (val, unit))
|
||||||
|
else:
|
||||||
|
self.console.sendLine("This application is up to date with the LBC blockchain.")
|
||||||
|
|
||||||
|
def _show_error(self, err):
|
||||||
|
logging.error(err.getTraceback())
|
||||||
|
self.console.sendLine("Unable to determine the status of the blockchain.")
|
||||||
|
|
||||||
|
|
||||||
|
class BlockchainStatusFactory(CommandHandlerFactory):
|
||||||
|
control_handler_class = BlockchainStatus
|
||||||
|
command = "get-blockchain-status"
|
||||||
|
short_help = "Show whether this application has caught up with the LBC blockchain"
|
||||||
|
full_help = "Show whether this applications has caught up with the LBC blockchain"
|
|
@ -2,6 +2,8 @@ import logging
|
||||||
from lbrynet.core.Session import LBRYSession
|
from lbrynet.core.Session import LBRYSession
|
||||||
import os.path
|
import os.path
|
||||||
import argparse
|
import argparse
|
||||||
|
import requests
|
||||||
|
import locale
|
||||||
from yapsy.PluginManager import PluginManager
|
from yapsy.PluginManager import PluginManager
|
||||||
from twisted.internet import defer, threads, stdio, task, error
|
from twisted.internet import defer, threads, stdio, task, error
|
||||||
from lbrynet.lbrynet_console.ConsoleControl import ConsoleControl
|
from lbrynet.lbrynet_console.ConsoleControl import ConsoleControl
|
||||||
|
@ -33,6 +35,7 @@ from lbrynet.lbrynet_console.ControlHandlers import ClaimNameFactory, GetNewWall
|
||||||
from lbrynet.lbrynet_console.ControlHandlers import ShowServerStatusFactory, ModifyServerSettingsFactory
|
from lbrynet.lbrynet_console.ControlHandlers import ShowServerStatusFactory, ModifyServerSettingsFactory
|
||||||
from lbrynet.lbrynet_console.ControlHandlers import ModifyLBRYFileOptionsChooserFactory, StatusFactory
|
from lbrynet.lbrynet_console.ControlHandlers import ModifyLBRYFileOptionsChooserFactory, StatusFactory
|
||||||
from lbrynet.lbrynet_console.ControlHandlers import PeerStatsAndSettingsChooserFactory, PublishFactory
|
from lbrynet.lbrynet_console.ControlHandlers import PeerStatsAndSettingsChooserFactory, PublishFactory
|
||||||
|
from lbrynet.lbrynet_console.ControlHandlers import BlockchainStatusFactory
|
||||||
from lbrynet.core.LBRYcrdWallet import LBRYcrdWallet
|
from lbrynet.core.LBRYcrdWallet import LBRYcrdWallet
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,7 +237,8 @@ class LBRYConsole():
|
||||||
if not lbrycrdd_path:
|
if not lbrycrdd_path:
|
||||||
lbrycrdd_path = self.default_lbrycrdd_path
|
lbrycrdd_path = self.default_lbrycrdd_path
|
||||||
d = defer.succeed(LBRYcrdWallet(self.db_dir, wallet_dir=self.lbrycrd_dir,
|
d = defer.succeed(LBRYcrdWallet(self.db_dir, wallet_dir=self.lbrycrd_dir,
|
||||||
wallet_conf=self.lbrycrd_conf, lbrycrdd_path=lbrycrdd_path))
|
wallet_conf=self.lbrycrd_conf,
|
||||||
|
lbrycrdd_path=lbrycrdd_path))
|
||||||
else:
|
else:
|
||||||
d = defer.succeed(PTCWallet(self.db_dir))
|
d = defer.succeed(PTCWallet(self.db_dir))
|
||||||
d.addCallback(lambda wallet: {"wallet": wallet})
|
d.addCallback(lambda wallet: {"wallet": wallet})
|
||||||
|
@ -267,8 +271,51 @@ class LBRYConsole():
|
||||||
|
|
||||||
dl.addCallback(lambda _: self.session.setup())
|
dl.addCallback(lambda _: self.session.setup())
|
||||||
|
|
||||||
|
dl.addCallback(lambda _: self.check_first_run())
|
||||||
|
|
||||||
|
dl.addCallback(self._show_first_run_result)
|
||||||
|
|
||||||
return dl
|
return dl
|
||||||
|
|
||||||
|
def check_first_run(self):
|
||||||
|
d = self.session.wallet.check_first_run()
|
||||||
|
d.addCallback(lambda is_first_run: self._do_first_run() if is_first_run else 0.0)
|
||||||
|
return d
|
||||||
|
|
||||||
|
def _do_first_run(self):
|
||||||
|
d = self.session.wallet.get_new_address()
|
||||||
|
|
||||||
|
def send_request(url, data):
|
||||||
|
r = requests.post(url, json=data)
|
||||||
|
if r.status_code == 200:
|
||||||
|
return r.json()['credits_sent']
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
def log_error(err):
|
||||||
|
log.warning("unable to request free credits. %s", err.getErrorMessage())
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
def request_credits(address):
|
||||||
|
url = "http://credreq.lbry.io/requestcredits"
|
||||||
|
data = {"address": address}
|
||||||
|
d = threads.deferToThread(send_request, url, data)
|
||||||
|
d.addErrback(log_error)
|
||||||
|
return d
|
||||||
|
|
||||||
|
d.addCallback(request_credits)
|
||||||
|
return d
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _show_first_run_result(credits_received):
|
||||||
|
if credits_received != 0.0:
|
||||||
|
points_string = locale.format_string("%.2f LBC", (round(credits_received, 2),),
|
||||||
|
grouping=True)
|
||||||
|
alert.info("Thank you for using LBRY! You have been given %s for free because we "
|
||||||
|
"love you. Please give them a few minutes to show up while you catch up "
|
||||||
|
"with our blockchain.\nTo check whether you've caught up with the blockchain, "
|
||||||
|
"use the command 'get-blockchain-status'.\nDownloading some files "
|
||||||
|
"may not work until you have downloaded the LBC blockchain.", points_string)
|
||||||
|
|
||||||
def _setup_lbry_file_manager(self):
|
def _setup_lbry_file_manager(self):
|
||||||
self.lbry_file_metadata_manager = DBLBRYFileMetadataManager(self.db_dir)
|
self.lbry_file_metadata_manager = DBLBRYFileMetadataManager(self.db_dir)
|
||||||
d = self.lbry_file_metadata_manager.setup()
|
d = self.lbry_file_metadata_manager.setup()
|
||||||
|
@ -318,10 +365,11 @@ class LBRYConsole():
|
||||||
lbrycrd_handlers = [
|
lbrycrd_handlers = [
|
||||||
AddStreamFromLBRYcrdNameFactory(self.sd_identifier, self.session,
|
AddStreamFromLBRYcrdNameFactory(self.sd_identifier, self.session,
|
||||||
self.session.wallet),
|
self.session.wallet),
|
||||||
ClaimNameFactory(self.session. wallet, self.lbry_file_manager,
|
ClaimNameFactory(self.session.wallet, self.lbry_file_manager,
|
||||||
self.session.blob_manager),
|
self.session.blob_manager),
|
||||||
GetNewWalletAddressFactory(self.session.wallet),
|
GetNewWalletAddressFactory(self.session.wallet),
|
||||||
PublishFactory(self.session, self.lbry_file_manager, self.session.wallet)
|
PublishFactory(self.session, self.lbry_file_manager, self.session.wallet),
|
||||||
|
BlockchainStatusFactory(self.session.wallet)
|
||||||
]
|
]
|
||||||
self.add_control_handlers(lbrycrd_handlers)
|
self.add_control_handlers(lbrycrd_handlers)
|
||||||
if self.peer_port is not None:
|
if self.peer_port is not None:
|
||||||
|
|
|
@ -226,7 +226,7 @@ class DownloaderApp(object):
|
||||||
def _start_downloader(self):
|
def _start_downloader(self):
|
||||||
self.downloader = LBRYDownloader()
|
self.downloader = LBRYDownloader()
|
||||||
d = self.downloader.start()
|
d = self.downloader.start()
|
||||||
d.addCallback(lambda _: self.downloader.do_first_run())
|
d.addCallback(lambda _: self.downloader.check_first_run())
|
||||||
d.addCallback(self._show_welcome_message)
|
d.addCallback(self._show_welcome_message)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@ class LBRYDownloader(object):
|
||||||
self.known_dht_nodes = [('104.236.42.182', 4000)]
|
self.known_dht_nodes = [('104.236.42.182', 4000)]
|
||||||
self.db_dir = os.path.join(os.path.expanduser("~"), ".lbrydownloader")
|
self.db_dir = os.path.join(os.path.expanduser("~"), ".lbrydownloader")
|
||||||
self.blobfile_dir = os.path.join(self.db_dir, "blobfiles")
|
self.blobfile_dir = os.path.join(self.db_dir, "blobfiles")
|
||||||
self.wallet_dir = os.path.join(os.path.expanduser("~"), ".lbrycrd")
|
|
||||||
self.wallet_conf = os.path.join(self.wallet_dir, "lbrycrd.conf")
|
|
||||||
self.peer_port = 3333
|
self.peer_port = 3333
|
||||||
self.dht_node_port = 4444
|
self.dht_node_port = 4444
|
||||||
self.run_server = True
|
self.run_server = True
|
||||||
|
@ -42,8 +40,10 @@ class LBRYDownloader(object):
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
from lbrynet.winhelpers.knownpaths import get_path, FOLDERID, UserHandle
|
from lbrynet.winhelpers.knownpaths import get_path, FOLDERID, UserHandle
|
||||||
self.download_directory = get_path(FOLDERID.Downloads, UserHandle.current)
|
self.download_directory = get_path(FOLDERID.Downloads, UserHandle.current)
|
||||||
|
self.wallet_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), "lbrycrd")
|
||||||
else:
|
else:
|
||||||
self.download_directory = os.getcwd()
|
self.download_directory = os.getcwd()
|
||||||
|
self.wallet_conf = os.path.join(self.wallet_dir, "lbrycrd.conf")
|
||||||
self.wallet_user = None
|
self.wallet_user = None
|
||||||
self.wallet_password = None
|
self.wallet_password = None
|
||||||
self.sd_identifier = StreamDescriptorIdentifier()
|
self.sd_identifier = StreamDescriptorIdentifier()
|
||||||
|
@ -267,26 +267,26 @@ class LBRYDownloader(object):
|
||||||
if not os.path.exists(self.blobfile_dir):
|
if not os.path.exists(self.blobfile_dir):
|
||||||
os.makedirs(self.blobfile_dir)
|
os.makedirs(self.blobfile_dir)
|
||||||
log.debug("Created the data directory: %s", str(self.blobfile_dir))
|
log.debug("Created the data directory: %s", str(self.blobfile_dir))
|
||||||
if not os.path.exists(self.wallet_dir):
|
if os.name == "nt":
|
||||||
os.makedirs(self.wallet_dir)
|
if not os.path.exists(self.wallet_dir):
|
||||||
if not os.path.exists(self.wallet_conf):
|
os.makedirs(self.wallet_dir)
|
||||||
lbrycrd_conf = open(self.wallet_conf, mode='w')
|
if not os.path.exists(self.wallet_conf):
|
||||||
self.wallet_user = "rpcuser"
|
lbrycrd_conf = open(self.wallet_conf, mode='w')
|
||||||
lbrycrd_conf.write("rpcuser=%s\n" % self.wallet_user)
|
self.wallet_user = "rpcuser"
|
||||||
self.wallet_password = binascii.hexlify(Random.new().read(20))
|
lbrycrd_conf.write("rpcuser=%s\n" % self.wallet_user)
|
||||||
lbrycrd_conf.write("rpcpassword=%s\n" % self.wallet_password)
|
self.wallet_password = binascii.hexlify(Random.new().read(20))
|
||||||
lbrycrd_conf.write("server=1\n")
|
lbrycrd_conf.write("rpcpassword=%s\n" % self.wallet_password)
|
||||||
lbrycrd_conf.close()
|
lbrycrd_conf.write("server=1\n")
|
||||||
self.first_run = True
|
lbrycrd_conf.close()
|
||||||
else:
|
else:
|
||||||
lbrycrd_conf = open(self.wallet_conf)
|
lbrycrd_conf = open(self.wallet_conf)
|
||||||
for l in lbrycrd_conf:
|
for l in lbrycrd_conf:
|
||||||
if l.startswith("rpcuser="):
|
if l.startswith("rpcuser="):
|
||||||
self.wallet_user = l[8:].rstrip('\n')
|
self.wallet_user = l[8:].rstrip('\n')
|
||||||
if l.startswith("rpcpassword="):
|
if l.startswith("rpcpassword="):
|
||||||
self.wallet_password = l[12:].rstrip('\n')
|
self.wallet_password = l[12:].rstrip('\n')
|
||||||
if l.startswith("rpcport="):
|
if l.startswith("rpcport="):
|
||||||
self.wallet_rpc_port = int(l[8:-1].rstrip('\n'))
|
self.wallet_rpc_port = int(l[8:-1].rstrip('\n'))
|
||||||
|
|
||||||
def _get_session(self):
|
def _get_session(self):
|
||||||
lbrycrdd_path = None
|
lbrycrdd_path = None
|
||||||
|
@ -349,30 +349,33 @@ class LBRYDownloader(object):
|
||||||
self.session.wallet)
|
self.session.wallet)
|
||||||
self.sd_identifier.add_stream_downloader_factory(LBRYFileStreamType, file_opener_factory)
|
self.sd_identifier.add_stream_downloader_factory(LBRYFileStreamType, file_opener_factory)
|
||||||
|
|
||||||
def do_first_run(self):
|
def check_first_run(self):
|
||||||
if self.first_run is True:
|
d = self.session.wallet.check_first_run()
|
||||||
d = self.session.wallet.get_new_address()
|
d.addCallback(lambda is_first_run: self._do_first_run() if is_first_run else 0.0)
|
||||||
|
return d
|
||||||
|
|
||||||
def send_request(url, data):
|
def _do_first_run(self):
|
||||||
r = requests.post(url, json=data)
|
d = self.session.wallet.get_new_address()
|
||||||
if r.status_code == 200:
|
|
||||||
return r.json()['credits_sent']
|
|
||||||
return 0.0
|
|
||||||
|
|
||||||
def log_error(err):
|
def send_request(url, data):
|
||||||
log.warning("unable to request free credits. %s", err.getErrorMessage())
|
r = requests.post(url, json=data)
|
||||||
return 0.0
|
if r.status_code == 200:
|
||||||
|
return r.json()['credits_sent']
|
||||||
|
return 0.0
|
||||||
|
|
||||||
def request_credits(address):
|
def log_error(err):
|
||||||
url = "http://credreq.lbry.io/requestcredits"
|
log.warning("unable to request free credits. %s", err.getErrorMessage())
|
||||||
data = {"address": address}
|
return 0.0
|
||||||
d = threads.deferToThread(send_request, url, data)
|
|
||||||
d.addErrback(log_error)
|
|
||||||
return d
|
|
||||||
|
|
||||||
d.addCallback(request_credits)
|
def request_credits(address):
|
||||||
|
url = "http://credreq.lbry.io/requestcredits"
|
||||||
|
data = {"address": address}
|
||||||
|
d = threads.deferToThread(send_request, url, data)
|
||||||
|
d.addErrback(log_error)
|
||||||
return d
|
return d
|
||||||
return defer.succeed(0.0)
|
|
||||||
|
d.addCallback(request_credits)
|
||||||
|
return d
|
||||||
|
|
||||||
def _resolve_name(self, uri):
|
def _resolve_name(self, uri):
|
||||||
return self.session.wallet.get_stream_info_for_name(uri)
|
return self.session.wallet.get_stream_info_for_name(uri)
|
||||||
|
|
Loading…
Add table
Reference in a new issue