lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.63k stars 2.07k forks source link

[bug]: Positive inbound fees mess with route finding #9058

Open DerEwige opened 1 week ago

DerEwige commented 1 week ago

By deactivating a security switch, it is possible to set positive inbound fees on LND nodes. Channels with positive inbound fees are not backwards compatible and they mess with the route finder in an unexpected way.

If a node (not knowing about inbound fees) tries a route containing a single hop with positive inbound fees, that route will fail. The failure is “insufficient Fee” at node X. When receiving this error the sender will attribute that error to the outbound channel of the node. But in reality, the error happened on the inbound channel.

By attributing the error to the wrong edge the ability to find routes decreases. Currently this effect is not very strong, as there are only very few nodes with positive inbound fees.

Positive inbound fees should be forbiden (in it's current form) to avoid total routing colaps across the whole network

TLDR: positve routing fees int its current form are a bug by design at best, or an attack on the network at worst

feelancer21 commented 1 week ago

I don't see that as a bug by design. I could also write an HTLC interceptor and block forwards from Bob to Alice, while allowing forwards from Carol to Alice. The result would be the same: the sender would not see that the incoming channel was the issue.

Internally within LND, we encounter a similar problem when we lower the inbound discounts. It will also fail on the outbound channel, but no update is sent for the inbound policy.

https://github.com/lightningnetwork/lnd/pull/6967

Roasbeef commented 1 week ago

Enabling positive inbound fees is off by default, it's also marked that it's a config field that really shouldn't be used at all outside of testing: https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf#L441-L446.

@feelancer21 also has a good point that nodes can arbitrarily reject payments via forwarding attempts, but that would disadvantage them, as they're giving up routing fees.