The spendable balance displayed in Sphinx currently is incorrect. From what I understand, the calculation is done on the total from getChannelBalance.
The balance should be assessed on a per-channel basis. Currently the formula seems to be
max(0, total_local_balance - total_local_reserve)
The actual spendable balance is
sum(max(0, local_balance - local_reserve))
For ex, user with 4 channels, with local balances 94445+25220+386892+11663 and reserves 1000+160000+10000+5000 currently gets 94445+25220+386892+11663-1000-160000-10000-5000=342220 as the displayed balance.
The correct value is max(0, 94445-1000)+max(0, 25220-160000)+max(0, 386892-10000)+max(0, 11663-5000)=477000
The spendable balance displayed in Sphinx currently is incorrect. From what I understand, the calculation is done on the total from getChannelBalance. The balance should be assessed on a per-channel basis. Currently the formula seems to be
max(0, total_local_balance - total_local_reserve)
The actual spendable balance is
sum(max(0, local_balance - local_reserve))
For ex, user with 4 channels, with local balances 94445+25220+386892+11663 and reserves 1000+160000+10000+5000 currently gets 94445+25220+386892+11663-1000-160000-10000-5000=342220 as the displayed balance.
The correct value is max(0, 94445-1000)+max(0, 25220-160000)+max(0, 386892-10000)+max(0, 11663-5000)=477000