Hi all!
Lately I've been working on a small python project to try approaching the pathfinding problem in lightning as a Min-cost network flow problem.
I know Renè Pickhardt already used this approach in order to prove the superiority of the Zero base fee approach, in fact I read his papers and got the gist of it.
Now I'm trying to model the problem mathematically - using the pyomo package in python - but I came up with a question that I couldn't find an answer for:
in a multi-path payment (MPP), can two HTLCs go though the same channel?
More specifically, I'm interested in understanding if the following situation can happen or not:
Nodes = {S, A, B, C, E, F, G, I, D} # S source, D destination
With S being the source node (aka the payer), D being the destination node (aka the payee).
The scope of the question does not include considerations about base or rate fees.
Node S computes the optimal path that minimises the fees for an amount and finds out that the optimal choice is to execute a MPP that follows this path(s):
B E A -> -> -> G -> D C F h0 h1 h2 h3 h4
where the first two hops (h1 and h2) see two parallel payments going on, then at the hop h3 the MPP converges to the node G and then procedes with the last hop to destination.
As far as I know, in classical MPP the preimage is the same for every parallel path (correct me if I'm wrong), thus I'm wondering if that thing is possible or not. Moreover, if there was an another hop such that:
B E A -> I -> -> -> G -> D C F h0 h1 h2 h3 h4 h5
would that be possible too? That meaning two HTLCs flowing in the same channel for the first hop, then splitting and the riconverging.
Hope the question is clear enough, otherwise I'm open to clarifications.
Thanks!
base_mpp
. NodeA creates two HTLCs using the same payment hash in NodeD's invoice for each HTLC. HTLC-1 is routed B->E->G->D and HTLC-2 is routed C->F->G->D. Remember, only NodeD knows the preimage for this invoice.