Repository navigation
fix(core): charge sole funder full base weights in single-funded DLCs - #241
Open
matthewjablack wants to merge 2 commits into
Open
matthewjablack wants to merge 2 commits into
matthewjablack wants to merge 2 commits into
Conversation
Match ddk-dlc: when the counterparty has no inputs, the funding party pays the full fund tx and CET base weights instead of half Add singleFunded option to dualFees and dualFundingCoinSelect
Only an explicit empty array marks the counterparty as non-funding; bitcoin-abstraction-layer passes null at offer time and must keep the half split instead of throwing Delegate dualFees to getFinalizerByCount and pin exact single-funded fee, threshold and funding tx values in tests
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
DualFundingTxFinalizeralways split the fund tx and CET base weights in half per party, so in a single-funded DLC (counterparty has no inputs) nobody paid the other half. This matches ddk-dlc, which bills the sole funder the full base weights, and fixes coin selection undershooting the funds ddk requires (a 5000 sat contract at 10 sat/vB was accepting 7950 sats of inputs when 8000 were needed).Changes
TxFinalizer.ts: when the counterparty has zero inputs, the funding party pays the full fund tx base weight and the full 500-weight CET base instead of half. Dual-funded fees are unchanged (107 / 249 per party).CoinSelect.ts:dualFeesanddualFundingCoinSelecttake an optional trailingsingleFundedflag (defaultfalse) that drops the synthetic accept input so the threshold is sized correctly.BatchDlcTxBuilder.calculateMaxCollateralalready passes empty accept inputs, so it picks up the fix with no changes.Note: upstream rust-dlc always splits the base weight in half. ddk-dlc is the one that deviates, but it is the counterparty in practice and the transaction underpays otherwise.