edouardparis / lntop

:zap: LN terminal dashboard :bar_chart:
MIT License
183 stars 24 forks source link

Add pretty amount formatting #80

Closed rkfg closed 2 years ago

rkfg commented 2 years ago

Amounts are hard to read without separators and in Bitcoin case the usual groups of three digits can be confusing because 1 BTC is 10e8 sats. Instead I implemented a better format proposed by satcomma. It's not exactly like the link describes because I replaced spaces with commas to make it look consistent with the main screen. Most amounts like channels and HTLCs don't need the BTC point because they're usually much smaller than 1 BTC so commas are fine. Total node capacities are usually greater than 1 BTC so it's appropriate there. I currently didn't patch the other screens that show amounts because of this reason. 2022-09-06_18-12-01

rkfg commented 2 years ago

Also added displaying max HTLC, it depends on the formatting function so I included it here. Max HTLC is an important policy parameter that's used by some node operators to indicate that the channel is almost empty and can't accept big HTLCs to lower forwarding error count. Unlike min HTLC it's displayed in sats because max HTLC is usually a big number so it makes sense. 2022-09-11_19-50-17

edouardparis commented 2 years ago

Looks good to me ! (untested)