mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
add more fields to list_channels
This commit is contained in:
parent
89460aecd8
commit
377210bc6f
2 changed files with 12 additions and 3 deletions
|
@ -769,7 +769,7 @@ class Commands:
|
||||||
|
|
||||||
@command('wn')
|
@command('wn')
|
||||||
def listchannels(self):
|
def listchannels(self):
|
||||||
return self.wallet.lnworker.list_channels()
|
return list(self.wallet.lnworker.list_channels())
|
||||||
|
|
||||||
@command('wn')
|
@command('wn')
|
||||||
def dumpgraph(self):
|
def dumpgraph(self):
|
||||||
|
|
|
@ -25,7 +25,8 @@ from .lnutil import (Outpoint, calc_short_channel_id, LNPeerAddr,
|
||||||
get_compressed_pubkey_from_bech32, extract_nodeid,
|
get_compressed_pubkey_from_bech32, extract_nodeid,
|
||||||
PaymentFailure, split_host_port, ConnStringFormatError,
|
PaymentFailure, split_host_port, ConnStringFormatError,
|
||||||
generate_keypair, LnKeyFamily)
|
generate_keypair, LnKeyFamily)
|
||||||
from electrum.lnaddr import lndecode
|
from .lnutil import LOCAL, REMOTE
|
||||||
|
from .lnaddr import lndecode
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -268,7 +269,15 @@ class LNWorker(PrintError):
|
||||||
def list_channels(self):
|
def list_channels(self):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
# we output the funding_outpoint instead of the channel_id because lnd uses channel_point (funding outpoint) to identify channels
|
# we output the funding_outpoint instead of the channel_id because lnd uses channel_point (funding outpoint) to identify channels
|
||||||
return [(chan.funding_outpoint.to_str(), chan.get_state()) for channel_id, chan in self.channels.items()]
|
for channel_id, chan in self.channels.items():
|
||||||
|
yield {
|
||||||
|
'channel_id': bh2u(chan.short_channel_id),
|
||||||
|
'channel_point': chan.funding_outpoint.to_str(),
|
||||||
|
'state': chan.get_state(),
|
||||||
|
'remote_pubkey': bh2u(chan.node_id),
|
||||||
|
'local_balance': chan.balance(LOCAL)//1000,
|
||||||
|
'remote_balance': chan.balance(REMOTE)//1000,
|
||||||
|
}
|
||||||
|
|
||||||
async def close_channel(self, chan_id):
|
async def close_channel(self, chan_id):
|
||||||
chan = self.channels[chan_id]
|
chan = self.channels[chan_id]
|
||||||
|
|
Loading…
Add table
Reference in a new issue