Merge pull request #781 from lbryio/disable_max_key_fee
Updated max_key_fee setting with disable_max_key_fee
This commit is contained in:
commit
06edd1f16a
7 changed files with 16 additions and 4 deletions
|
@ -11,6 +11,8 @@ at anytime.
|
||||||
### Added
|
### Added
|
||||||
* Add link to instructions on how to change the default peer port
|
* Add link to instructions on how to change the default peer port
|
||||||
* Add `peer_port` to settings configurable using `settings_set`
|
* Add `peer_port` to settings configurable using `settings_set`
|
||||||
|
* Added an option to disable max key fee check.
|
||||||
|
*
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
*
|
*
|
||||||
|
|
|
@ -751,6 +751,7 @@ Args:
|
||||||
'run_on_startup': (bool) currently not supported
|
'run_on_startup': (bool) currently not supported
|
||||||
'data_rate': (float) data rate,
|
'data_rate': (float) data rate,
|
||||||
'max_key_fee': (float) maximum key fee,
|
'max_key_fee': (float) maximum key fee,
|
||||||
|
'disable_max_key_fee': (bool) true to disable max_key_fee check,
|
||||||
'download_directory': (str) path of where files are downloaded,
|
'download_directory': (str) path of where files are downloaded,
|
||||||
'peer_port': (int) port through which daemon should connect,
|
'peer_port': (int) port through which daemon should connect,
|
||||||
'max_upload': (float), currently not supported
|
'max_upload': (float), currently not supported
|
||||||
|
|
|
@ -603,6 +603,7 @@ Args:
|
||||||
'run_on_startup': (bool) currently not supported
|
'run_on_startup': (bool) currently not supported
|
||||||
'data_rate': (float) data rate,
|
'data_rate': (float) data rate,
|
||||||
'max_key_fee': (float) maximum key fee,
|
'max_key_fee': (float) maximum key fee,
|
||||||
|
'disable_max_key_fee': (bool) true to disable max_key_fee check,
|
||||||
'download_directory': (str) path of where files are downloaded,
|
'download_directory': (str) path of where files are downloaded,
|
||||||
'peer_port': (int) port through which daemon should connect,
|
'peer_port': (int) port through which daemon should connect,
|
||||||
'max_upload': (float), currently not supported
|
'max_upload': (float), currently not supported
|
||||||
|
|
|
@ -187,6 +187,7 @@ ADJUSTABLE_SETTINGS = {
|
||||||
# TODO: writing json on the cmd line is a pain, come up with a nicer
|
# TODO: writing json on the cmd line is a pain, come up with a nicer
|
||||||
# parser for this data structure. maybe 'USD:25'
|
# parser for this data structure. maybe 'USD:25'
|
||||||
'max_key_fee': (json.loads, {'currency': 'USD', 'amount': 50.0}),
|
'max_key_fee': (json.loads, {'currency': 'USD', 'amount': 50.0}),
|
||||||
|
'disable_max_key_fee': (bool, False),
|
||||||
'min_info_rate': (float, .02), # points/1000 infos
|
'min_info_rate': (float, .02), # points/1000 infos
|
||||||
'min_valuable_hash_rate': (float, .05), # points/1000 infos
|
'min_valuable_hash_rate': (float, .05), # points/1000 infos
|
||||||
'min_valuable_info_rate': (float, .05), # points/1000 infos
|
'min_valuable_info_rate': (float, .05), # points/1000 infos
|
||||||
|
|
|
@ -179,6 +179,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
self.blobfile_dir = conf.settings['BLOBFILES_DIR']
|
self.blobfile_dir = conf.settings['BLOBFILES_DIR']
|
||||||
self.data_rate = conf.settings['data_rate']
|
self.data_rate = conf.settings['data_rate']
|
||||||
self.max_key_fee = conf.settings['max_key_fee']
|
self.max_key_fee = conf.settings['max_key_fee']
|
||||||
|
self.disable_max_key_fee = conf.settings['disable_max_key_fee']
|
||||||
self.download_timeout = conf.settings['download_timeout']
|
self.download_timeout = conf.settings['download_timeout']
|
||||||
self.run_reflector_server = conf.settings['run_reflector_server']
|
self.run_reflector_server = conf.settings['run_reflector_server']
|
||||||
self.wallet_type = conf.settings['wallet']
|
self.wallet_type = conf.settings['wallet']
|
||||||
|
@ -429,6 +430,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
'cache_time': int,
|
'cache_time': int,
|
||||||
'reflect_uploads': bool,
|
'reflect_uploads': bool,
|
||||||
'share_usage_data': bool,
|
'share_usage_data': bool,
|
||||||
|
'disable_max_key_fee': bool,
|
||||||
'peer_search_timeout': int,
|
'peer_search_timeout': int,
|
||||||
'sd_download_timeout': int,
|
'sd_download_timeout': int,
|
||||||
}
|
}
|
||||||
|
@ -455,6 +457,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
|
|
||||||
self.data_rate = conf.settings['data_rate']
|
self.data_rate = conf.settings['data_rate']
|
||||||
self.max_key_fee = conf.settings['max_key_fee']
|
self.max_key_fee = conf.settings['max_key_fee']
|
||||||
|
self.disable_max_key_fee = conf.settings['disable_max_key_fee']
|
||||||
self.download_directory = conf.settings['download_directory']
|
self.download_directory = conf.settings['download_directory']
|
||||||
self.download_timeout = conf.settings['download_timeout']
|
self.download_timeout = conf.settings['download_timeout']
|
||||||
|
|
||||||
|
@ -628,6 +631,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
|
|
||||||
self.streams[claim_id] = GetStream(self.sd_identifier, self.session,
|
self.streams[claim_id] = GetStream(self.sd_identifier, self.session,
|
||||||
self.exchange_rate_manager, self.max_key_fee,
|
self.exchange_rate_manager, self.max_key_fee,
|
||||||
|
self.disable_max_key_fee,
|
||||||
conf.settings['data_rate'], timeout,
|
conf.settings['data_rate'], timeout,
|
||||||
file_name)
|
file_name)
|
||||||
try:
|
try:
|
||||||
|
@ -1115,6 +1119,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
[<download_timeout> | --download_timeout=<download_timeout>]
|
[<download_timeout> | --download_timeout=<download_timeout>]
|
||||||
[<peer_port> | --peer_port=<peer_port>]
|
[<peer_port> | --peer_port=<peer_port>]
|
||||||
[<max_key_fee> | --max_key_fee=<max_key_fee>]
|
[<max_key_fee> | --max_key_fee=<max_key_fee>]
|
||||||
|
[<disable_max_key_fee> | --disable_max_key_fee=<disable_max_key_fee>]
|
||||||
[<use_upnp> | --use_upnp=<use_upnp>]
|
[<use_upnp> | --use_upnp=<use_upnp>]
|
||||||
[<run_reflector_server> | --run_reflector_server=<run_reflector_server>]
|
[<run_reflector_server> | --run_reflector_server=<run_reflector_server>]
|
||||||
[<cache_time> | --cache_time=<cache_time>]
|
[<cache_time> | --cache_time=<cache_time>]
|
||||||
|
@ -1138,6 +1143,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
LBC
|
LBC
|
||||||
BTC
|
BTC
|
||||||
USD
|
USD
|
||||||
|
<disable_max_key_fee>, --disable_max_key_fee=<disable_max_key_fee> : (bool), False
|
||||||
<use_upnp>, --use_upnp=<use_upnp> : (bool), True
|
<use_upnp>, --use_upnp=<use_upnp> : (bool), True
|
||||||
<run_reflector_server>, --run_reflector_server=<run_reflector_server> : (bool), False
|
<run_reflector_server>, --run_reflector_server=<run_reflector_server> : (bool), False
|
||||||
<cache_time>, --cache_time=<cache_time> : (int), 150
|
<cache_time>, --cache_time=<cache_time> : (int), 150
|
||||||
|
|
|
@ -31,12 +31,13 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class GetStream(object):
|
class GetStream(object):
|
||||||
def __init__(self, sd_identifier, session, exchange_rate_manager,
|
def __init__(self, sd_identifier, session, exchange_rate_manager,
|
||||||
max_key_fee, data_rate=None, timeout=None,
|
max_key_fee, disable_max_key_fee, data_rate=None, timeout=None,
|
||||||
file_name=None):
|
file_name=None):
|
||||||
|
|
||||||
self.timeout = timeout or conf.settings['download_timeout']
|
self.timeout = timeout or conf.settings['download_timeout']
|
||||||
self.data_rate = data_rate or conf.settings['data_rate']
|
self.data_rate = data_rate or conf.settings['data_rate']
|
||||||
self.max_key_fee = max_key_fee or conf.settings['max_key_fee'][1]
|
self.max_key_fee = max_key_fee or conf.settings['max_key_fee'][1]
|
||||||
|
self.disable_max_key_fee = disable_max_key_fee or conf.settings['disable_max_key_fee']
|
||||||
self.download_directory = conf.settings['download_directory']
|
self.download_directory = conf.settings['download_directory']
|
||||||
self.file_name = file_name
|
self.file_name = file_name
|
||||||
self.timeout_counter = 0
|
self.timeout_counter = 0
|
||||||
|
@ -97,7 +98,7 @@ class GetStream(object):
|
||||||
fee.amount)
|
fee.amount)
|
||||||
if converted_fee_amount > self.wallet.get_balance():
|
if converted_fee_amount > self.wallet.get_balance():
|
||||||
raise InsufficientFundsError('Unable to pay the key fee of %s' % converted_fee_amount)
|
raise InsufficientFundsError('Unable to pay the key fee of %s' % converted_fee_amount)
|
||||||
if converted_fee_amount > max_key_fee_amount:
|
if converted_fee_amount > max_key_fee_amount and not self.disable_max_key_fee:
|
||||||
raise KeyFeeAboveMaxAllowed('Key fee %s above max allowed %s' % (converted_fee_amount,
|
raise KeyFeeAboveMaxAllowed('Key fee %s above max allowed %s' % (converted_fee_amount,
|
||||||
max_key_fee_amount))
|
max_key_fee_amount))
|
||||||
converted_fee = {
|
converted_fee = {
|
||||||
|
|
|
@ -73,10 +73,11 @@ class GetStreamTests(unittest.TestCase):
|
||||||
exchange_rate_manager = DummyExchangeRateManager(market_feeds, rates)
|
exchange_rate_manager = DummyExchangeRateManager(market_feeds, rates)
|
||||||
exchange_rate_manager = mock.Mock(spec=ExchangeRateManager)
|
exchange_rate_manager = mock.Mock(spec=ExchangeRateManager)
|
||||||
max_key_fee = {'currency':"LBC", 'amount':10, 'address':''}
|
max_key_fee = {'currency':"LBC", 'amount':10, 'address':''}
|
||||||
|
disable_max_key_fee = False
|
||||||
data_rate = {'currency':"LBC", 'amount':0, 'address':''}
|
data_rate = {'currency':"LBC", 'amount':0, 'address':''}
|
||||||
|
|
||||||
getstream = Downloader.GetStream(sd_identifier, session,
|
getstream = Downloader.GetStream(sd_identifier, session,
|
||||||
exchange_rate_manager, max_key_fee, timeout=3, data_rate=data_rate)
|
exchange_rate_manager, max_key_fee, disable_max_key_fee, timeout=3, data_rate=data_rate)
|
||||||
getstream.pay_key_fee_called = False
|
getstream.pay_key_fee_called = False
|
||||||
|
|
||||||
self.clock = task.Clock()
|
self.clock = task.Clock()
|
||||||
|
@ -180,4 +181,3 @@ class GetStreamTests(unittest.TestCase):
|
||||||
getstream.downloader.running_status = ManagedEncryptedFileDownloader.STATUS_STOPPED
|
getstream.downloader.running_status = ManagedEncryptedFileDownloader.STATUS_STOPPED
|
||||||
self.clock.advance(1)
|
self.clock.advance(1)
|
||||||
downloader, f_deferred = yield start
|
downloader, f_deferred = yield start
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue