dont add expected payment when payment rate is 0
This commit is contained in:
parent
4027733f2c
commit
8f3b53197f
4 changed files with 18 additions and 41 deletions
|
@ -14,7 +14,7 @@ at anytime.
|
||||||
*
|
*
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
*
|
* Dont add expected payment to wallet when payment rate is 0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,10 @@ def log_response(fn):
|
||||||
elif future.exception():
|
elif future.exception():
|
||||||
exc, traceback = future.exception_info()
|
exc, traceback = future.exception_info()
|
||||||
log.warning('Failed to send an analytics event', exc_info=(type(exc), exc, traceback))
|
log.warning('Failed to send an analytics event', exc_info=(type(exc), exc, traceback))
|
||||||
else:
|
# GRIN TURNED THIS OFF. Segment only has one response: {"success": true}
|
||||||
response = future.result()
|
# else:
|
||||||
log.debug('Response (%s): %s', response.status_code, response.content)
|
# response = future.result()
|
||||||
|
# log.debug('Response (%s): %s', response.status_code, response.content)
|
||||||
|
|
||||||
@functools.wraps(fn)
|
@functools.wraps(fn)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
|
|
@ -5,12 +5,10 @@ from twisted.protocols.basic import FileSender
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
|
||||||
|
|
||||||
from lbrynet.core.Offer import Offer
|
from lbrynet.core.Offer import Offer
|
||||||
from lbrynet import analytics
|
from lbrynet import analytics
|
||||||
from lbrynet.interfaces import IQueryHandlerFactory, IQueryHandler, IBlobSender
|
from lbrynet.interfaces import IQueryHandlerFactory, IQueryHandler, IBlobSender
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,11 +210,14 @@ class BlobRequestHandler(object):
|
||||||
|
|
||||||
def set_expected_payment():
|
def set_expected_payment():
|
||||||
log.debug("Setting expected payment")
|
log.debug("Setting expected payment")
|
||||||
if self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None:
|
if (
|
||||||
|
self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None
|
||||||
|
and self.blob_data_payment_rate > 0
|
||||||
|
):
|
||||||
# TODO: explain why 2**20
|
# TODO: explain why 2**20
|
||||||
self.wallet.add_expected_payment(self.peer,
|
self.wallet.add_expected_payment(self.peer,
|
||||||
self.currently_uploading.length * 1.0 *
|
self.currently_uploading.length * 1.0 *
|
||||||
self.blob_data_payment_rate / 2**20)
|
self.blob_data_payment_rate / 2 ** 20)
|
||||||
self.blob_bytes_uploaded = 0
|
self.blob_bytes_uploaded = 0
|
||||||
self.peer.update_stats('blobs_uploaded', 1)
|
self.peer.update_stats('blobs_uploaded', 1)
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -1264,29 +1264,11 @@ class Daemon(AuthJSONRPCServer):
|
||||||
"""
|
"""
|
||||||
Get daemon settings
|
Get daemon settings
|
||||||
|
|
||||||
Args:
|
|
||||||
None
|
|
||||||
Returns:
|
Returns:
|
||||||
(dict) Dictionary of daemon settings
|
(dict) Dictionary of daemon settings
|
||||||
{
|
See ADJUSTABLE_SETTINGS in lbrynet/conf.py for full list of settings
|
||||||
'run_on_startup': (bool) currently not supported
|
|
||||||
'data_rate': (float) data rate
|
|
||||||
'max_key_fee': (float) maximum key fee
|
|
||||||
'download_directory': (str) path of where files are downloaded
|
|
||||||
'max_upload': (float), currently not supported
|
|
||||||
'max_download': (float), currently not supported
|
|
||||||
'download_timeout': (int) download timeout in seconds
|
|
||||||
'max_search_results': (int) max search results
|
|
||||||
'wallet_type': (str) wallet type
|
|
||||||
'delete_blobs_on_remove': (bool) delete blobs on removal
|
|
||||||
'peer_port': (int) peer port
|
|
||||||
'dht_node_port': (int) dht node port
|
|
||||||
'use_upnp': (bool) use upnp if true
|
|
||||||
}
|
|
||||||
"""
|
"""
|
||||||
|
return self._render_response(conf.settings.get_adjustable_settings_dict())
|
||||||
log.info("Get daemon settings")
|
|
||||||
return self._render_response(conf.settings.get_current_settings_dict())
|
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
def jsonrpc_set_settings(self, **kwargs):
|
def jsonrpc_set_settings(self, **kwargs):
|
||||||
|
@ -1296,6 +1278,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
return self.jsonrpc_settings_set(**kwargs)
|
return self.jsonrpc_settings_set(**kwargs)
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
|
@defer.inlineCallbacks
|
||||||
def jsonrpc_settings_set(self, **kwargs):
|
def jsonrpc_settings_set(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
Set daemon settings
|
Set daemon settings
|
||||||
|
@ -1308,22 +1291,14 @@ class Daemon(AuthJSONRPCServer):
|
||||||
'max_upload': (float), currently not supported
|
'max_upload': (float), currently not supported
|
||||||
'max_download': (float), currently not supported
|
'max_download': (float), currently not supported
|
||||||
'download_timeout': (int) download timeout in seconds
|
'download_timeout': (int) download timeout in seconds
|
||||||
|
'search_timeout': (float) search timeout in seconds
|
||||||
|
'cache_time': (int) cache timeout in seconds
|
||||||
Returns:
|
Returns:
|
||||||
(dict) settings dict
|
(dict) Updated dictionary of daemon settings
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _log_settings_change():
|
yield self._update_settings(kwargs)
|
||||||
log.info(
|
defer.returnValue(conf.settings.get_adjustable_settings_dict())
|
||||||
"Set daemon settings to %s",
|
|
||||||
json.dumps(conf.settings.get_adjustable_settings_dict()))
|
|
||||||
|
|
||||||
d = self._update_settings(kwargs)
|
|
||||||
d.addErrback(lambda err: log.info(err.getTraceback()))
|
|
||||||
d.addCallback(lambda _: _log_settings_change())
|
|
||||||
d.addCallback(
|
|
||||||
lambda _: self._render_response(conf.settings.get_adjustable_settings_dict()))
|
|
||||||
|
|
||||||
return d
|
|
||||||
|
|
||||||
def jsonrpc_help(self, command=None):
|
def jsonrpc_help(self, command=None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue