mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-23 08:04:20 +01:00
summary: add an 'exclude' parameter to the summary command
This is useful to get an idea of the balance proportions of your channels when you have a big channel that mess them up.
This commit is contained in:
committed by
Christian Decker
parent
438a7e5974
commit
db4357a766
@@ -26,6 +26,9 @@ if have_utf8:
|
|||||||
else:
|
else:
|
||||||
draw = Charset('#', '[', '-', '/', ']', '#', '|')
|
draw = Charset('#', '[', '-', '/', ']', '#', '|')
|
||||||
|
|
||||||
|
summary_description = "Gets summary information about this node.\n"\
|
||||||
|
"Pass a list of scids to the {exclude} parameter"\
|
||||||
|
" to exclude some channels from the outputs."
|
||||||
|
|
||||||
class PriceThread(threading.Thread):
|
class PriceThread(threading.Thread):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -89,8 +92,8 @@ def append_header(table, max_msat):
|
|||||||
% (draw.left, short_str, draw.mid, short_str, draw.right))
|
% (draw.left, short_str, draw.mid, short_str, draw.right))
|
||||||
|
|
||||||
|
|
||||||
@plugin.method("summary")
|
@plugin.method("summary", long_desc=summary_description)
|
||||||
def summary(plugin):
|
def summary(plugin, exclude=''):
|
||||||
"""Gets summary information about this node."""
|
"""Gets summary information about this node."""
|
||||||
|
|
||||||
reply = {}
|
reply = {}
|
||||||
@@ -107,7 +110,6 @@ def summary(plugin):
|
|||||||
else:
|
else:
|
||||||
reply['my_address'] = plugin.my_address
|
reply['my_address'] = plugin.my_address
|
||||||
|
|
||||||
|
|
||||||
utxos = [int(f['amount_msat']) for f in funds['outputs']
|
utxos = [int(f['amount_msat']) for f in funds['outputs']
|
||||||
if f['status'] == 'confirmed']
|
if f['status'] == 'confirmed']
|
||||||
reply['num_utxos'] = len(utxos)
|
reply['num_utxos'] = len(utxos)
|
||||||
@@ -126,6 +128,8 @@ def summary(plugin):
|
|||||||
if c['state'] != 'CHANNELD_NORMAL':
|
if c['state'] != 'CHANNELD_NORMAL':
|
||||||
continue
|
continue
|
||||||
active_channel = True
|
active_channel = True
|
||||||
|
if c['short_channel_id'] in exclude:
|
||||||
|
continue
|
||||||
if p['connected']:
|
if p['connected']:
|
||||||
reply['num_connected'] += 1
|
reply['num_connected'] += 1
|
||||||
if c['our_reserve_msat'] < c['to_us_msat']:
|
if c['our_reserve_msat'] < c['to_us_msat']:
|
||||||
|
|||||||
Reference in New Issue
Block a user