Skip to content

fork rust dlc crates#106

Merged
bennyhodl merged 9 commits into
masterfrom
fork-rust-dlc-crates
Aug 2, 2025
Merged

fork rust dlc crates#106
bennyhodl merged 9 commits into
masterfrom
fork-rust-dlc-crates

Conversation

@bennyhodl
Copy link
Copy Markdown
Owner

  • dep: add dlc, dlc-messages, & dlc-trie to dlcdevkit
  • feat: splice DLC to ddk-manager

This PR pulls in rust-dlc/{dlc, dlc-messages, dlc-trie} to dlcdevkit

The decision was made after slow release times and some related features to improve dlcdevkit

Along with pulling in the crates it includes new features that are ported from my fork of rust-dlc

single funded
splicing

@bennyhodl bennyhodl force-pushed the fork-rust-dlc-crates branch from 1cdefca to 729ac7a Compare July 29, 2025 14:45
Copy link
Copy Markdown
Contributor

@matthewjablack matthewjablack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let max_witness_len = if fund_input.dlc_input.is_some() {
220
} else {
107
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to worried about this being 108? I think this is set to 108 in node-dlc

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rust-dlc has it at 107, i just continued that4


let key_id = match contract {
Contract::Confirmed(c) => Ok(c.accepted_contract.offered_contract.keys_id),
_ => Err(Error::InvalidState(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to change this to Signed (or have a state PreConfirmed) because if you initially created a single funding transaction with no change, then you have no way to fee bump, other than splice in more collateral as a CPFP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, this seems unnecessary unless it becomes a large problem down the road

@bennyhodl bennyhodl force-pushed the fork-rust-dlc-crates branch 2 times, most recently from 1dfde3a to c93dfda Compare July 31, 2025 22:17
@bennyhodl bennyhodl force-pushed the fork-rust-dlc-crates branch 3 times, most recently from 41421dc to fd9a283 Compare August 1, 2025 13:41
@bennyhodl bennyhodl force-pushed the fork-rust-dlc-crates branch from fd9a283 to ed5744b Compare August 1, 2025 14:34
Copy link
Copy Markdown
Contributor

@matthewjablack matthewjablack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking solid, just a couple edge cases for tests that could be added


self.store
.update_contract(&Contract::PreClosed(preclosed_contract.clone()))
.await?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if splice transaction ends up being RBF'd?

I'm assuming this doesn't block it from changing to Close somewhere else with an execution transaction

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so

Comment thread dlc/src/lib.rs
pub fund: Transaction,
/// The contract execution transactions for closing the contract on a
/// certain outcome
pub cets: Vec<Transaction>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, a splice tx is just added to cets correct (in the DlcTransactions object)?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

.send_splice_offer(
&test_params.contract_input,
spliced_input.bob_public_key,
&spliced_input.contract_id,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edge case, what if we try to splice the same contract twice?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also would be good to have a test that references a contract ID that doesn't exist

i.e. fake_contract_id

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe a test with collateral below dust as well (to make sure that fails)

@bennyhodl bennyhodl force-pushed the fork-rust-dlc-crates branch from 25c5c08 to 20295bd Compare August 2, 2025 14:45
Copy link
Copy Markdown
Contributor

@matthewjablack matthewjablack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests LGTM 🎉

@bennyhodl bennyhodl merged commit 8528a0f into master Aug 2, 2025
54 checks passed
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.

2 participants