Skip to content

messaging: add the PayoutScriptOverrides TLV on DlcOffer - #242

Open
matthewjablack wants to merge 1 commit into
masterfrom
feat/payout-script-overrides
Open

matthewjablack wants to merge 1 commit into
masterfrom
feat/payout-script-overrides

Conversation

@matthewjablack

@matthewjablack matthewjablack commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Adds a PayoutScriptOverrides TLV on DlcOffer, type 65005. It names the enum outcomes whose CET pays a script other than the accepter's, so a liquidated-by-0x… outcome can pay the liquidator's Bitcoin address. Amounts stay in the descriptor, only the accepter's output script is swapped. The accepter is the lender in a loan, and a liquidator is paid in the lender's place.

The offer reads it back as a typed payoutScriptOverrides field instead of an unknown TLV, writes it in the TLV stream, and includes it in toJSON's tlvs. Wire format is the same as the ddk-messages record: BigSize count, then per entry a BigSize prefixed UTF-8 outcome and a u16 prefixed script. The bytes are pinned in a test here and in dlcdevkit so either encoder drifting fails there rather than at signature verification.

node-dlc only builds the funding transaction, so the CET rewrite lives in BAL (AtomicFinance/bitcoin-abstraction-layer#218) and in dlcdevkit (bennyhodl/dlcdevkit#222). I left fromJSON alone since the JSON path drops every TLV today.

Messaging tests, lint, and build pass.

Names the enum outcomes whose CET pays a script other than the offerer's, so
a liquidated-by-<address> outcome can pay the liquidator's Bitcoin address.
Type 65005, same wire format as the ddk-messages record, with the bytes
pinned in a test on both sides.

The offer reads it back as a typed field instead of an unknown TLV, writes it
in the TLV stream, and includes it in toJSON's tlvs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant