lightningdevkit / rust-lightning

A highly modular Bitcoin Lightning library written in Rust. It's rust-lightning, not Rusty's Lightning!
Other
1.14k stars 357 forks source link

Change max_value_in_flight based on channel being public #2851

Open TheBlueMatt opened 7 months ago

TheBlueMatt commented 7 months ago

If a channel isn't public, our "reduce max_value_in_flight to provide routed payments more privacy" thing doesn't make sense...cause the channel isn't routing payments. Thus, our default config should depend on if the channel is public here, IMO.

acceleratesage commented 6 months ago

Hello @TheBlueMatt, I'm looking into this but as I'm just getting started with the code base I lack a bit of information.

My best guess is you are talking about the anti_probing_penalty_msat: https://github.com/lightningdevkit/rust-lightning/blob/bf3bc420c7ff80f033f3a7871168e3b63ae34c1c/lightning/src/routing/scoring.rs#L604

If so, as far as I can see, that already get's only applied on public channels as channel_penalty_msat returns 0 for non-public hops: https://github.com/lightningdevkit/rust-lightning/blob/bf3bc420c7ff80f033f3a7871168e3b63ae34c1c/lightning/src/routing/scoring.rs#L1330

Given that you're aware of how this works much better than I am, I suppose you are talking about something different?

Cheers, Simon

tnull commented 6 months ago

Hello @TheBlueMatt, I'm looking into this but as I'm just getting started with the code base I lack a bit of information.

My best guess is you are talking about the anti_probing_penalty_msat:

https://github.com/lightningdevkit/rust-lightning/blob/bf3bc420c7ff80f033f3a7871168e3b63ae34c1c/lightning/src/routing/scoring.rs#L604

Close, I think this issue is around the actual htlc_maximum_msat we set, not the anti_probing_penalty_msat we score peers with who set the former lower.

For context: generally, peers provide more privacy if they limit htlc_maximum_msat as this reduces the capability of probing peers to gain information about the actual liquidity, at least if it is above htlc_maximum_msat. E.g., if a peer sets htlc_maximum_msat to 10% of the channel capacity, a probing peer could only test the actual liquidity when it drops below these 10%. So for forwarding ('public') nodes, limiting htlc_maximum_msat is a privacy feature, but for non-forwarding nodes it just unnecessarily restricts our maximum HTLC size.

So, we should only apply the limit if we have any announced ('public') channels, i.e., can be considered a forwarding node.

jbesraa commented 6 months ago

hey @SimonAdameit
are you still interested in doing this?

acceleratesage commented 6 months ago

@jbesraa Unfortunately I haven't had the time recently and if I find some time to dedicate to the project, I could just pick another issue if this is already done. So if you or someone else wants to work on it, please go ahead!

Sharmalm commented 6 months ago

Hii, @jbesraa I am interested in this issue, I can try this issue if you are not taking it :)

jbesraa commented 6 months ago

sure @Sharmalm, feel free to take this

Sharmalm commented 6 months ago

Thanks @jbesraa

TheBlueMatt commented 6 months ago

Don't think we should hold 112 on this.

Sharmalm commented 5 months ago

Hello everyone, My approach to solve this issue is update the changes in configuration in lightning/src/util/config/ChannelConfig so that inbound_htlc_maximum_msat will only be included in if channel is public.