ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.84k stars 901 forks source link

getinfo or listfunds should show estimate of total available to spend #1878

Open rustyrussell opened 6 years ago

rustyrussell commented 6 years ago

Someone asked, and currently you need to manually sum listfunds output, then subtract the fees you'd need. That seems like a job for getinfo.

fixone commented 6 years ago

using jq getting all available funds (fees notwithstanding) is as simple as

~/lightning/cli/lightning-cli listfunds | jq '.outputs | .[] | .value' | jq -s add

to get funds available in the c-lightning wallet as unspent outputs and

~/lightning/cli/lightning-cli listpeers | jq -r '.peers | to_entries[] | select (.value.channels[].state=="CHANNELD_NORMAL") | .value.channels[].msatoshi_to_us  ' | jq -s add | expr $(</dev/stdin) / 1000 | echo $(</dev/stdin)  "satoshi available"

to get all the funds available on our end in all NORMAL channels

ZmnSCPxj commented 5 years ago

Summary plugin in lightningd/plugins does this (avail_out), and more: https://github.com/lightningd/plugins/tree/master/summary

Should we consider "bless" summary? Or make a "simpler" summary plugin?

darosior commented 4 years ago

Most people running C-lightning are, I believe, using summary for this purpose now. Do we still need a new field ?

ZmnSCPxj commented 4 years ago

If the feature is so useful, it might actually be better to put in the built-in plugins a C version of summary.

darosior commented 4 years ago

Or directly pull summary.py ? /me hides

ZmnSCPxj commented 4 years ago

Best not to depend on python code for our "stock" release. Because of the disasters in upgrading to Python 3.x, you really need the latest Python (3.7 or 3.8 or higher, there are some weird incompatibilities and outright bugs in lower Python 3.x series) to work on most Python code. Unfortunately existing long-term-support OSs still come with Python 3.5 or lower, meaning to decently run the latest Python 3.x code you need to install pyenv. This is an additional requirement that current C-Lightning does not actually have in order to run (it is a requirement for it to get tested, but users do not test the software they use anyway, they just run it).

darosior commented 4 years ago

Yeah you previously made a point regarding depending and i agree with you.

This is currently a build requirement and we get a lot of users coming to irc struggling with mako or mrkd. -------- Original Message -------- On Aug 21, 2020, 07:34, ZmnSCPxj, ZmnSCPxj jxPCSmnZ wrote:

Best not to depend on python code for our "stock" release. Because of the disasters in upgrading to Python 3.x, you really need the latest Python (3.7 or 3.8 or higher, there are some weird incompatibilities and outright bugs in lower Python 3.x series) to work on most Python code. Unfortunately existing long-term-support OSs still come with Python 3.5 or lower, meaning to decently run the latest Python 3.x code you need to install pyenv. This is an additional requirement that current C-Lightning does not actually have in order to run (it is a requirement for it to get tested, but users do not test the software they use anyway, they just run it).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

ZmnSCPxj commented 4 years ago

Does it? I once managed to install lightningd without a decent python3. I think. Maybe I did it after installing pyenv?

darosior commented 4 years ago

Yes, for the manpages and for wire messages.

vincenzopalazzo commented 4 years ago

I'm sorry for the intrusion, but I want to share my idea about the additional plugin to help the user to see the node/wallet condition with some simplification.

If the feature is so useful, it might actually be better to put in the built-in plugins

I agree, to have some plugin directly inside c-lightning, in this example, this is util to see how money the user has available inside the node; because in some cases, the new user doesn't know all details when they start to use the node (e.g: me last year, when ran the first time the c-lightning node, now is much better but not too better :smile: )

Is very useful to have a plugin inside the node to give these details. In addition, maybe we can start to think a plugin like plugin pay that is a wrapper for some command such as listpays wrapper of listsendpays.

For instance: a plugin called wallet.c that have some rpc methods, such as:

I shared only what I think, if I said something stupid, please ignore it :smile:

ZmnSCPxj commented 4 years ago

Yes, for the manpages and for wire messages.

Ah. But for our source-tree releases those are already pre-built, and thus do not require either if you are just buliding and running (and not modifying) lightningd; I know that was what I used to install lightningd on a long-term-support OS.