Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Commitment Fees #52

Closed
Roasbeef opened this issue Oct 21, 2016 · 1 comment
Closed

Dynamic Commitment Fees #52

Roasbeef opened this issue Oct 21, 2016 · 1 comment
Labels
intermediate Issues suitable for developers moderately familiar with the codebase and LN p2p Code related to the peer-to-peer behaviour
Milestone

Comments

@Roasbeef
Copy link
Member

Roasbeef commented Oct 21, 2016

Currently there's a hard-coded fee of 5k satoshis on the commitment transaction. This sufficed for initial tests but needs to be made dynamic for real-world use in order to maintain the invariant that the current commitment transaction is able to be included in the next block.

In the Lighting Summit, we agreed that for now the initiator pays all fees on the commitment transaction. Therefore any additional fees due to added HTLC's should be subtracted from the initiator's balance if necessary. Additionally messages need to be added to the wire protocol to allow the initiator to signal that they wish to change their desired fee rate on the commitment transaction.

This section within the v1 specification is still being fleshed out. As the specification becomes more concrete, this issue will be updated to detail the requirements as laid out by the spec.

A related issue if the lack of any dynamic fee estimation in lnd currently. In order to robustly implement dynamic commitment fees, we'll also need an internal model which predicts the fee required to make it into the Nth block.

type FeeEstimator interface {
    // EstimateFee takes in a target for the number of blocks 
    // until an initial confirmation and returns the estimated fee 
    // expressed in satoshis/byte. 
    EstimateFee(numBlocks uint32) uint64

    EstimateConfirmation(satPerByte int64) uint32
}

As a placeholder, the above interface can be created with a concrete implementation which simply returns our current hard-coded fee "5000 satoshis". This will allow for a two-step migration, with the first step being simply a move-only refactoring.

See these relevant areas within the spec:

Relevant btcd PR:

@Roasbeef Roasbeef added the intermediate Issues suitable for developers moderately familiar with the codebase and LN label Oct 21, 2016
@Roasbeef Roasbeef added this to the Lightning V1 Specification milestone Oct 21, 2016
@Roasbeef Roasbeef added p2p Code related to the peer-to-peer behaviour state machine labels Oct 21, 2016
@Roasbeef Roasbeef modified the milestones: v0.3-alpha, v0.2-alpha Mar 29, 2017
@Roasbeef
Copy link
Member Author

Closed by #199!!!

Still a few more edge cases to be handled (incorporation of fee_update messages, and corner cases related to zero valued outputs, but can handled later).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intermediate Issues suitable for developers moderately familiar with the codebase and LN p2p Code related to the peer-to-peer behaviour
Projects
None yet
Development

No branches or pull requests

1 participant