feat: add invoice group all-or-nothing release#57
Merged
Kingsman-99 merged 2 commits intoMay 29, 2026
Conversation
- Add group_key, invoice_group_key, load_group, group_all_funded helpers - Add create_invoice_group(invoice_ids) -> group_id - pay() auto-release skips if invoice is grouped and not all members funded - release() asserts all group members funded, then releases all Pending members - Non-grouped invoices behave identically to before - 3 new tests: partial fund blocks release, all funded releases both, non-grouped unaffected - All 10 tests pass, clippy clean Closes Stellar-split#33
|
@marvs8 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements grouped invoice all-or-nothing release, as described in issue #33.
Changes
lib.rs:
group_key,invoice_group_key,load_group,group_all_fundedcreate_invoice_group(invoice_ids: Vec<u64>) -> u64— links invoices and maps each back to the grouppay()auto-release now skips if the invoice belongs to a group where not all members are fully fundedrelease()asserts all group members are funded, then releases every Pending member in the group; non-grouped invoices behave identically to beforetest.rs:
test_group_partial_fund_blocks_release— funds only one member, verifiesrelease()panics with"group members not fully funded"test_group_all_funded_releases_both— funds both members, verifies both are Released and recipients receive correct amountstest_non_grouped_invoice_unaffected— verifies solo invoices still auto-release normallyAcceptance Criteria
create_invoice_group()links multiple invoice IDsrelease()on a group member panics if any other member is not fully fundedcargo testpass (10/10)cargo clippypasses with zero warningsCloses #33