mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-22 23:54:20 +01:00
cleanups: feeadjuster, drain and summary
This commit is contained in:
@@ -12,7 +12,7 @@ Community curated plugins for c-lightning.
|
||||
| [backup][backup] | A simple and reliable backup plugin |
|
||||
| [boltz-channel-creation][boltz] | A c-lightning plugin for Boltz Channel Creation Swaps |
|
||||
| [btcli4j][btcli4j] | A Bitcoin Backend to enable safely the pruning mode, and support also rest APIs. |
|
||||
| [commando][commando] | Authorize peers to run commands on your node, and running commands on them. |
|
||||
| [commando][commando] | Authorize peers to run commands on your node, and running commands on them. |
|
||||
| [csvexportpays][csvexportpays] | A plugin that exports all payments to a CSV file |
|
||||
| [currencyrate][currencyrate] | A plugin to convert other currencies to BTC using web requests |
|
||||
| [donations][donations] | A simple donations page to accept donations from the web |
|
||||
|
||||
@@ -293,7 +293,7 @@ def try_for_htlc_fee(plugin, payload, peer_id, amount, chunk, spendable_before):
|
||||
return False # should not happen, but maybe API changes
|
||||
payload['success_msg'].append(f"{amount + fees}msat sent over {len(route)} "
|
||||
f"hops to {payload['command']} {amount}msat "
|
||||
f"[{chunk + 1}/{payload['chunks']}")
|
||||
f"[{chunk + 1}/{payload['chunks']}]")
|
||||
# we need to wait for HTLC to resolve, so remaining amounts
|
||||
# can be calculated correctly for the next chunk
|
||||
wait_ours(plugin, payload['scid'], ours)
|
||||
|
||||
@@ -66,18 +66,16 @@ def get_ratio_hard(our_percentage):
|
||||
def get_peer_id_for_scid(plugin: Plugin, scid: str):
|
||||
for peer in plugin.peers:
|
||||
for ch in peer['channels']:
|
||||
if 'short_channel_id' in ch:
|
||||
if ch['short_channel_id'] == scid:
|
||||
return peer['id']
|
||||
if ch.get('short_channel_id') == scid:
|
||||
return peer['id']
|
||||
return None
|
||||
|
||||
|
||||
def get_local_channel_for_scid(plugin: Plugin, scid: str):
|
||||
for peer in plugin.peers:
|
||||
for ch in peer['channels']:
|
||||
if 'short_channel_id' in ch:
|
||||
if ch['short_channel_id'] == scid:
|
||||
return ch
|
||||
if ch.get('short_channel_id') == scid:
|
||||
return ch
|
||||
return None
|
||||
|
||||
|
||||
@@ -236,8 +234,8 @@ def feeadjust(plugin: Plugin, scid: str = None):
|
||||
for peer in plugin.peers:
|
||||
for chan in peer["channels"]:
|
||||
if chan["state"] == "CHANNELD_NORMAL":
|
||||
_scid = chan["short_channel_id"]
|
||||
if scid != None and scid != _scid:
|
||||
_scid = chan.get("short_channel_id")
|
||||
if scid is not None and scid != _scid:
|
||||
continue
|
||||
plugin.adj_balances[_scid] = {
|
||||
"our": int(chan["to_us_msat"]),
|
||||
|
||||
@@ -24,7 +24,7 @@ try:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Channel = namedtuple('Channel', ['total', 'ours', 'theirs', 'pid', 'private', 'connected', 'scid', 'avail', 'base' ,'permil'])
|
||||
Channel = namedtuple('Channel', ['total', 'ours', 'theirs', 'pid', 'private', 'connected', 'scid', 'avail', 'base', 'permil'])
|
||||
Charset = namedtuple('Charset', ['double_left', 'left', 'bar', 'mid', 'right', 'double_right', 'empty'])
|
||||
if have_utf8:
|
||||
draw = Charset('╟', '├', '─', '┼', '┤', '╢', '║')
|
||||
@@ -265,7 +265,7 @@ def init_db(plugin, retry_time=4, sleep_time=1):
|
||||
retry += 1
|
||||
|
||||
if db is None:
|
||||
raise Error("db initialization error")
|
||||
raise RuntimeError("db initialization error")
|
||||
return db
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user