Lightning: Allow setting feerate on per-channel basis

Created on 4 Feb 2019  路  12Comments  路  Source: ElementsProject/lightning

As requested by ctrlbreak on IRC: documenting here.

  • [ ] Add db fields for per-channel feebase + ppm
  • [ ] Put these fields into struct channel
  • [ ] Use the fields in forward_htlc instead of global values
  • [ ] Show fields in listchannels
  • [ ] Plumb db fields through to gossipd for advertising.
  • [ ] Provide API eg. setchannelfee <short-chanid-or-peerid> <base> <ppm>
  • [ ] Create tests, CHANGELOG.md, man page.
  • [ ] Dance a happy dance.
feature forwarding good first issue json-rpc

Most helpful comment

@m-schmoock i believe it means 'part per millionth' -- the total fee is a 'percent' of the amount routed, in millionths plus the base

All 12 comments

That seems fairly doable. Anyone volunteering for this? I could start erliest in two weeks.

also another question: might it be reasonable to implement this as a plugin. In this way more hooks and events that people would eventually want to expose would have to be implemented in c-lightning

Hey, I think I can have a look at this. But it would be, besides isolating issue https://github.com/ElementsProject/lightning/pull/2321 , my first contribution here, so please don't expect me being fast :D

Started working on it: 7c5cdee682ff4a4bdc2d6ce0f590ae32e5cf18aa

@rustyrussell can you explain what "ppm" means in this context?

@m-schmoock i believe it means 'part per millionth' -- the total fee is a 'percent' of the amount routed, in millionths plus the base

Here is my workspace: https://github.com/ElementsProject/lightning/compare/master...m-schmoock:feerate-per-channel

I will add the API function setchannelfee tomorrow.

Hey, two quick questions:

  • lightningd/lightningd.h line 43 Is there a reason why the config.fee_per_satoshi value is a signed integer?
  • lightningd/lightningd.h line 495ff the comment tells that the fee is calculated using fee_proportional_millionths / 1000000 but later in the code its fee_per_satoshi / 1000000. Is ppm == fee_per_satoshi or is the comment misleading?

That's probably a left-over from the old idea of allowing negative fees. We abandoned quite a while ago.

  • lightningd/lightningd.h line 495ff the comment tells that the fee is calculated using fee_proportional_millionths / 1000000 but later in the code its fee_per_satoshi / 1000000. Is ppm == fee_per_satoshi or is the comment misleading?

Proportional fee and fee_per_satoshi are the same (proportional refers to the number of satoshis transferred). Just a bit of inconsistent naming :wink:

Thx. Addressed the first issue by PR https://github.com/ElementsProject/lightning/pull/2336

Almost everything done: https://github.com/ElementsProject/lightning/pull/2342
Need a review and feedback

Was this page helpful?
0 / 5 - 0 ratings

Related issues

willcl-ark picture willcl-ark  路  4Comments

brunoaduarte picture brunoaduarte  路  5Comments

agilob picture agilob  路  4Comments

AndiMacTen picture AndiMacTen  路  3Comments

cdecker picture cdecker  路  4Comments