pull down to refresh

I spent the day understanding and fixing a bug in lnd-manageJ's payment system. Turns out, Nicehash has two nodes, and two channels between those nodes. One worth 5 BTC (https://amboss.space/edge/917695285539373056), one just 0.01 BTC (https://amboss.space/edge/915246673132126208). Quite the difference. To make things worse, the smaller channel is free, while the larger one charges 1ppm. Not so much of a difference, but still.
While running a "top up" payment (rebalancing using Pickhardt payments), the larger channel was used first (because of the size it's deemed better than the smaller channel, despite the costs). My code learned that some decent amount is available on that channel, due to a failure further down the line. This information was then also propagated to the other, smaller, channel. In subsequent attempts, both channels were used: the smaller channel up to the maximum, the larger channel for the remainder. Sadly, the smaller channel actually was rather empty, which confused my code into running in circles.
After understanding this issue, I took the channel ID into account when storing and using this kind of liquidity information. This way, the larger channel and the smaller channel are treated individually, which seems good at first glance (and actually worked as expected, as far as I know).
However, with parallel channels between two nodes (at least when they share their fee settings), the forwarding lightning network server is free to pick any of these parallel channels. As such, if I request a route via channel ID 123, the actual channel used might be one with ID 456. This unexpected ID is also returned in failure responses, messing up the code I just "fixed".
In the end, I think I'm better off leaving the code "as is". Which means: combining the information I have about parallel channels. Which also means: routing between the two Nicehash nodes won't really work. Similar issues might exist for other nodes that have parallel channels with different fee settings.
A couple of things here: it sounds like managej collapses the multigraph into a simple graph, coalescing parallel edges. That'd explain why witnessing balance on one also causes the other to be used. Secondly you point out correctly that the forwarding node may chose to use another channel (the scid now is more of an alias for the remote node, rather than being used as a channel identifier), however the spec also mandates that the forwarding node must use the specified scid when returning an error, which is the confusion you are facing here. That forwarding node is not spec compliant.
reply
Interesting. Can you point to where this is described in the spec?
reply
Hm, I can't find the spec verbiage, but here's the discussion from 6y back: https://github.com/lightning/bolts/pull/503#discussion_r232644170
The spec proposal does suggest keeping the fee schedules of parallel channels aligned, but there is no requirement of that. The discussion on what to return errors for is quite interesting and touches the points you mentioned in the OP.
reply
What are parallel channels?
reply
Two or more lightning network channels connecting the same pair of nodes.
reply