lightninglabs / lightninglabs/faraday

openchannel with pushsats isn't accounted for

Open
#112 3 comments 0 reactions 0 assignees View on GitHub
accounting bug
Dominant language
Go
Stars
130
Forks
35
Avg merge
7h 54m
Merged PRs (30d)
5

Description

When you use openchannel with the push_sats argument (ie. open channel worth 10 BTC and push 5 BTC to the other side from the beginning state)

I doubt anyone will use push_sats on mainnet in prod... but in our test environment it was very obvious since we use push_sats all the time, and everything is wonky because of it.

Also, should we be considering LOCAL_CHANNEL_OPEN capacity as debited funds?

Currently it shows `amount: 10 BTC, credit: false` for the channel open when I still control half the funds in the channel.

Perhaps LOCAL_CHANNEL_OPEN should only "debit":

1. Any amount pushed in first state via push_sats
2. Any amount that is not usable on our end (set aside for closing fees etc.) (These "set aside" things can be credited during close if we don't use them all)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the openchannel path and LOCAL_CHANNEL_OPEN accounting, focusing on how push_sats affects the reported amount and credit status. Compare the current treatment with the proposed debit rules for pushed and unusable funds. Done means channel balances consistently reflect funds controlled locally, including the initial push_sats amount.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, fintech-quant
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.