fedimint icon indicating copy to clipboard operation
fedimint copied to clipboard

feat: Support split partial invoice payments

Open benthecarman opened this issue 1 year ago • 11 comments

Closes #5103

This should give functional support for doing split/partial payments of invoices for the v1 lightning module.

benthecarman avatar May 29 '24 22:05 benthecarman

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!

benthecarman avatar May 31 '24 22:05 benthecarman

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

benthecarman avatar Jun 03 '24 18:06 benthecarman

Converting to draft for now as I still need to test the functionality end-to-end

benthecarman avatar Jun 04 '24 15:06 benthecarman

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.

benthecarman avatar Jun 11 '24 16:06 benthecarman

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

benthecarman avatar Jun 12 '24 20:06 benthecarman

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

benthecarman avatar Jun 12 '24 20:06 benthecarman

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

benthecarman avatar Jun 13 '24 18:06 benthecarman

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!

m1sterc001guy avatar Jun 13 '24 19:06 m1sterc001guy

Responded to review and added tests for db migrations

benthecarman avatar Jun 14 '24 15:06 benthecarman

rebased and fixed the nit, don't know how to make a devimint test, happy to learn though

benthecarman avatar Jun 17 '24 18:06 benthecarman

Refactored to bring back the old sending code when not doing a partial payment. Also split into smaller functions

benthecarman avatar Jun 19 '24 22:06 benthecarman

@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)?

elsirion avatar Jul 10 '24 12:07 elsirion

This can wait

benthecarman avatar Jul 10 '24 12:07 benthecarman

rebased

benthecarman avatar Jul 11 '24 21:07 benthecarman

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 avatar Jul 11 '24 21:07 dpc

@dpc it was done for lnv2 only I think

benthecarman avatar Jul 11 '24 21:07 benthecarman

Thanks. I deleted it from the release notes now.

dpc avatar Jul 11 '24 22:07 dpc

@fedimint/lightning What's the status here? It's been a while.

dpc avatar Oct 16 '24 19:10 dpc

I think we should close this, if we want to support it we can for LNv2

m1sterc001guy avatar Oct 16 '24 19:10 m1sterc001guy