feat: Support split partial invoice payments
Closes #5103
This should give functional support for doing split/partial payments of invoices for the v1 lightning module.
Trying to play with this in harbor and the payment doesn't seem to be claimed. Still figuring out what is going wrong..
FWIW the db migrations seemed to work fine though!
Refactored on the gateway side for making the split payments, still need to test but this copies what they did on the cashu side
https://github.com/cashubtc/nutshell/pull/492
Converting to draft for now as I still need to test the functionality end-to-end
Something I was thinking about for this in incorporating the amount into the operation id. Right now it is just payment_hash and attempt index.
Successfully did a split lightning payment! On this, running two mutinynet federations with gateways that supports this if people want to test:
fed11qgqp78thwden5te0vejkg6tdd9h8gepwvchxxctjd4skutnvdakz7qqpyrkhcqkf44mltuzezxxgx2uj0d5xlylnme2dzmsh5aqfrxmzhc6zwnnvp3w
fed11qgqzvfrhwden5te0vejkg6tdd9h8gepwvccjumr0wejhg6r9vf6kcmrn9e3k7mf0qqqjp6yssfzp93ggzzutusy42anq72jpxv5xvu0x7uvyuaq06gx0jf7faudwfx
can use this branch of harbor. Will need to add a federation, fund it, then add the second and receive again. Any lightning payments from then on will be split in half between the two federations
Ended up having to rewrite how pay_private implemented for partial payments, may make sense to bring back the old code and only use what I added for partial payments. Also need to make sure the new sending code there is secure against stuck htlcs. timeouts, etc
Fixed up to address the concerns about stuck payments and @m1sterc001guy's other comments. Working on re-testing but getting issues from the tls feature in some stuff
LGTM, comments are mostly about logging and nits. I will sign off after there's some test coverage for the db migration.
More incentive to get MPP payments working when receiving inside Fedimint so Fedimint's can do partial payments to other Fedimints!
Responded to review and added tests for db migrations
rebased and fixed the nit, don't know how to make a devimint test, happy to learn though
Refactored to bring back the old sending code when not doing a partial payment. Also split into smaller functions
@benthecarman @TonyGiorgio how important is this to you, do you want to get it into 0.4.0 (not ideal to block) or 0.4.1 (managable imo)?
This can wait
rebased
Can you verify the "Implemented multi-mint LN payments." from https://github.com/fedimint/fedimint/releases/tag/v0.4.0-rc.0 ? The commit messages was there, but seeing this PR still opened, I'm wondering if I haven't misundertand something.
@dpc it was done for lnv2 only I think
Thanks. I deleted it from the release notes now.
@fedimint/lightning What's the status here? It's been a while.
I think we should close this, if we want to support it we can for LNv2