Open myxmaster opened 4 months ago
Wonder if this could be related to the testnet3 stuff going on rn or if it's just our pending balance calculation
I experienced this when testnet3 block time was back to >3 minutes, so if I had to guess, I would say it is not because of the testnet attack.
Definitely not a testnet issue. This time I used Regtest.
I started fresh with 1,000,000 sats on-chain, no channels:
Then I opened a 500,000 sats channel (3,140 sats commit fee, 330 sats anchor output) using 1 sat/vByte on-chain fee (resulting in 166 sats channel open fee) and I get this with a false pending amount of 996,364:
After mining 1 block, it is 100% correct (500,000-3,140-330=496,530):
After mining additional 2 blocks (3 total), also 100% correct:
It seems the false pending amount is calculated like this: 1,000,000-3,140-330-166=996,364 originalAmount-commitFee-anchorOutput-onChainFee
The combined balance (on the top) currently always contains also unconfirmed on-chain balance. This actually only makes sense if it is from UTXOs from ourselves.
The pending combined balance (clock icon) consists of unconfirmed on-chain and Lightning balance. So the unconfirmed on-chain balance is counted double.
I suggest the following:
If unconfirmed balance is a UTXO to and from ourselves, it should be considered as confirmed. So it should only be part of the combined balance, not of the pending combined balance.
If unconfirmed balance is a UTXO to but not from ourselves, it should be considered as unconfirmed and so only be part of the pending combined balance, not the combined balance.
To achieve this, we would have to check pending transactions whenever there is unconfirmed on-chain balance.
Also, we should make the UI more clear about what pending balance is. For example with a + sign indicating that the pending balance is on top of the total balance. This should also be displayed in the balance sliders.
Describe the bug
It seems there is a bug leading to wrong amounts being displayed for a while after a new channel was opened. After some time it switches to correct numbers.
In this example I had 100k sats on-chain, then opened 2 channels:![grafik](https://github.com/ZeusLN/zeus/assets/77545287/1ae28adc-1362-48fd-a69e-eca855948c8e)
This is what Zeus displayed:![grafik](https://github.com/ZeusLN/zeus/assets/77545287/174d1880-91e1-4325-affd-72ae8b934f44)
65,699+55,699 is more than 100,000 which doesn't make sense. The on-chain balance (42,260) is correct, regarding the Lightning balance I am not sure... Maybe this is accounting for the 30k channel opening and deducting some sats (channel reserve, whatever).
Reproduce
Open a new channel and then go to balance view, maybe refresh manually if no pending amount is visible yet.
ZEUS version
v0.9.0
Node interface
Embedded LND
Network
Clearnet
Device
Android Emulator Pixel 7 Pro
Device operating system
Android 14
Log output
No response