helpme: if channels are open assume complete funds

When all funds have been spend for channels, the plugin
was reporting 'INCOMPLETE: no funds'. This doesn't seem right.
This commit is contained in:
Michael Schmoock
2020-12-15 09:32:31 +01:00
parent 8e7df25910
commit af26527638

View File

@@ -436,6 +436,7 @@ node! Be prepared to lose your funds (but please report a bug if you do!)
funds = plugin.rpc.listfunds()['outputs'] funds = plugin.rpc.listfunds()['outputs']
payments = plugin.rpc.listpays()['pays'] payments = plugin.rpc.listpays()['pays']
invoices = plugin.rpc.listinvoices()['invoices'] invoices = plugin.rpc.listinvoices()['invoices']
channels = get_channel_list(peers, None)
if info['network'] != 'bitcoin': if info['network'] != 'bitcoin':
r += "\n*** You are on TESTNET, not real bitcoin! See 'helpme mainnet'" r += "\n*** You are on TESTNET, not real bitcoin! See 'helpme mainnet'"
@@ -448,12 +449,14 @@ node! Be prepared to lose your funds (but please report a bug if you do!)
'bling': False} 'bling': False}
r += "\nSTAGE 1 (funds): " r += "\nSTAGE 1 (funds): "
if len(funds) == 0: if len(funds) == 0 and len(channels) == 0:
r += "INCOMPLETE: No bitcoins yet. Try 'helpme funds'" r += "INCOMPLETE: No bitcoins yet. Try 'helpme funds'"
elif len(funds) == 0 and len(channels) > 0:
r += "COMPLETE (all funds used for channels)"
else: else:
funds = Millisatoshi(1000 * sum([f['value'] for f in funds funds = Millisatoshi(1000 * sum([f['value'] for f in funds
if f['status'] == 'confirmed'])) if f['status'] == 'confirmed']))
r += "COMPLETE ({} a.k.a {})".format(funds, funds.to_btc_str()) r += "COMPLETE ({} a.k.a. {})".format(funds, funds.to_btc_str())
stages['funds'] = True stages['funds'] = True
r += "\nSTAGE 2 (peers): " r += "\nSTAGE 2 (peers): "
@@ -464,7 +467,6 @@ node! Be prepared to lose your funds (but please report a bug if you do!)
stages['peers'] = True stages['peers'] = True
r += "\nSTAGE 3 (channels): " r += "\nSTAGE 3 (channels): "
channels = get_channel_list(peers, None)
starting = [c['total_msat'] for c in channels starting = [c['total_msat'] for c in channels
if c['state'] == 'CHANNELD_AWAITING_LOCKIN'] if c['state'] == 'CHANNELD_AWAITING_LOCKIN']
normal = [c['total_msat'] for c in channels normal = [c['total_msat'] for c in channels