Repository navigation
ddk-manager: splice offers that spend several contracts - #235
Open
matthewjablack wants to merge 1 commit into
Open
matthewjablack wants to merge 1 commit into
matthewjablack wants to merge 1 commit into
Conversation
Add send_merge_splice_offer and send_merge_splice_offer_with_announcements, which build one offer whose funding transaction spends the funding outputs of several Confirmed contracts at once. The single-contract splice methods now delegate to them. A contract may be named only once, every one must be Confirmed with the counterparty, and an empty list is refused. The rest of the splice path already handled a list of DLC inputs: funding transaction construction, per-input signing and verification, and pre-closing every spent contract once the splice is seen. Only the offer entry point took a single contract id. Tests drive two confirmed contracts through a merge and assert the merged funding transaction spends both, both prior contracts close against it, and the merged contract settles.
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
A splice offer can now spend several
Confirmedcontracts at once, merging them into one contract.Manager::send_merge_splice_offerandsend_merge_splice_offer_with_announcementstake a slice of contract ids and build one offer with one DLC input per contract.send_splice_offer_with_announcementsdelegates to the new method with a one-element slice, so the single-contract path is unchanged.Confirmedcontract, a contract with another counterparty, or an empty list is refused withInvalidParameters/InvalidStatebefore anything is reserved or persisted.Everything downstream of the offer already handled a list of DLC inputs:
PartyParams::dlc_inputsis aVec,create_spliced_dlc_transactionsappends every one, the sign and verify steps loop per funding input, andpreclose_spliced_contractspre-closes every contract a splice funding transaction spends. The only single-contract spot was the offer entry point, sinceSignedContract::get_dlc_inputis crate-private.Tests
manager_execution_testsgets aMergeSplicepath: fund a second contract, merge both, settle the merged contract. It asserts the merged funding transaction spends both prior funding outputs, the offer carries one DLC input per prior contract, both prior contracts goPreClosedon sign andClosedagainst the merged funding transaction on confirm, the splicing party's wallet pays only the fee, a replaced contract cannot be spliced again alone or in another merge, and the merged contract settles from either party.merge_splice_enum_single_oracle_testmerge_splice_enum_single_oracle_by_accept_party_test(the acceptor of both contracts offers the merge, so its key is the remote key on both inputs)merge_splice_numerical_3_of_3_testRun locally with the test env, all three pass, as does
splice_in_enum_single_oracle_testfor the delegating path.cargo clippy -p ddk-manager -- -D warningsandcargo fmt --checkare clean.Why
Lygos wants to merge two live loans into one lock without settling either on chain first. The contracts and enclave already treat every funding input as a possible prior claim, so the only missing piece was an offer that names more than one.