forked from lightningdevkit/rust-lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Custom Transactions] Define the
TxBuilder
trait
This commit defines the `TxBuilder` trait to give users the ability to customize the build of the lightning commitment transactions. The `TxBuilder` trait has a single method, `build_commitment_transaction`, which builds the commitment transaction, and populates the output indices of the HTLCs passed in. Remove generic from `CommitmentTransaction::new` For the greatest compatibility with bindings, the argument is now a `Vec<HTLCOutputInCommitment>`. These non-dust HTLCs are populated during the construction of `CommitmentTransaction` and eventually cached by the object. Anything interested in these populated HTLCs should now use `CommitmentTransaction::htlcs`. Back in channel, we choose to do a brute force search over the HTLC-source pairs to assign their output indices. This is O(n^2) over ~1k HTLCs in the worst case. This case is very rare/non-existent at the moment. Feel free to optimize if LN channels start seeing an increasing number of HTLCs on their commitment transactions.
- Loading branch information
Showing
7 changed files
with
324 additions
and
193 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.