commands: clean-up inject_fees cmd
This commit is contained in:
@@ -1079,9 +1079,9 @@ class Commands:
|
|||||||
|
|
||||||
@command('n')
|
@command('n')
|
||||||
async def inject_fees(self, fees):
|
async def inject_fees(self, fees):
|
||||||
import ast
|
# e.g. use from Qt console: inject_fees("{25: 1009, 10: 15962, 5: 18183, 2: 23239}")
|
||||||
self.network.config.fee_estimates = ast.literal_eval(fees)
|
fee_est = ast.literal_eval(fees)
|
||||||
self.network.notify('fee')
|
self.network.update_fee_estimates(fee_est=fee_est)
|
||||||
|
|
||||||
@command('wn')
|
@command('wn')
|
||||||
async def enable_htlc_settle(self, b: bool, wallet: Abstract_Wallet = None):
|
async def enable_htlc_settle(self, b: bool, wallet: Abstract_Wallet = None):
|
||||||
|
|||||||
@@ -534,13 +534,14 @@ class Network(Logger, NetworkRetryManager[ServerAddr]):
|
|||||||
return {}
|
return {}
|
||||||
return self.interface.fee_estimates_eta
|
return self.interface.fee_estimates_eta
|
||||||
|
|
||||||
def update_fee_estimates(self):
|
def update_fee_estimates(self, *, fee_est: Dict = None):
|
||||||
e = self.get_fee_estimates()
|
if fee_est is None:
|
||||||
for nblock_target, fee in e.items():
|
fee_est = self.get_fee_estimates()
|
||||||
|
for nblock_target, fee in fee_est.items():
|
||||||
self.config.update_fee_estimates(nblock_target, fee)
|
self.config.update_fee_estimates(nblock_target, fee)
|
||||||
if not hasattr(self, "_prev_fee_est") or self._prev_fee_est != e:
|
if not hasattr(self, "_prev_fee_est") or self._prev_fee_est != fee_est:
|
||||||
self._prev_fee_est = copy.copy(e)
|
self._prev_fee_est = copy.copy(fee_est)
|
||||||
self.logger.info(f'fee_estimates {e}')
|
self.logger.info(f'fee_estimates {fee_est}')
|
||||||
self.notify('fee')
|
self.notify('fee')
|
||||||
|
|
||||||
@with_recent_servers_lock
|
@with_recent_servers_lock
|
||||||
|
|||||||
Reference in New Issue
Block a user