Skip to content

feat: use contract_flags bit 0 to redirect refund to accepter#157

Open
matthewjablack wants to merge 2 commits into
bennyhodl:masterfrom
matthewjablack:feat/contract-flags-refund-to-accepter
Open

feat: use contract_flags bit 0 to redirect refund to accepter#157
matthewjablack wants to merge 2 commits into
bennyhodl:masterfrom
matthewjablack:feat/contract-flags-refund-to-accepter

Conversation

@matthewjablack
Copy link
Copy Markdown
Contributor

Summary

Use bit 0 of the existing contract_flags byte on DlcOffer to signal that all refund transaction
proceeds go to the accepter. When the flag is set, the offerer's refund output is Amount::ZERO
(dust-discarded) and the accepter receives total_collateral.

Changes

  • Add REFUND_TO_ACCEPTER_FLAG constant (0x01) in dlc/src/lib.rs
  • Add contract_flags: u8 parameter to create_dlc_transactions, create_spliced_dlc_transactions, and
    create_cets_and_refund_tx
  • Modify refund output construction to redirect all funds to accepter when flag is set
  • Add contract_flags: u8 field to OfferedContract struct with serde default for backwards compatibility
  • Wire contract_flags through OfferDlc ↔ OfferedContract conversions
  • Thread contract_flags through channel transaction creation (create_channel_transactions,
    create_renewal_channel_transactions)
  • Propagate contract_flags from offered_contract at all call sites in contract_updater.rs and
    channel_updater.rs
  • Add contract_flags to OfferedContract binary serialization
  • Propagate contract_flags from offered_contract at all call sites in contract_updater.rs and
    channel_updater.rs
  • Add contract_flags to OfferedContract binary serialization
  • Add unit test verifying single-output refund TX pays total collateral to accepter's payout SPK
  • Update existing tests, benchmarks, and compatibility tests with default 0 flag

create_renewal_channel_transactions)

  • Propagate contract_flags from offered_contract at all call sites in contract_updater.rs and
    channel_updater.rs
  • Add contract_flags to OfferedContract binary serialization
  • Add unit test verifying single-output refund TX pays total collateral to accepter's payout SPK
  • Update existing tests, benchmarks, and compatibility tests with default 0 flag

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