-
Notifications
You must be signed in to change notification settings - Fork 415
[Custom Transactions] Add TxBuilder
trait, support fixed additional outputs
#3775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+563
−230
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
098b98e
Remove the last raw cast in `ChannelContext::build_commitment_stats`
tankyleo ebf6b13
Delete `CommitmentStats.{broadcaster_dust_limit_sat, feerate_per_kw}`
tankyleo 5688658
Delete `CommitmentStats.total_anchors_sat`
tankyleo aacaf77
Account for newly trimmed HTLCs in `ChannelContext::can_send_update_fee`
tankyleo f399c91
Add `TxBuilder::commit_tx_fee_sat`
tankyleo 85cc09e
Include HTLC amts in `ClaimableOnChannelClose.transaction_fee_satoshis`
tankyleo 07b7940
Add `TxBuilder::subtract_non_htlc_outputs`
tankyleo 39cb0a3
Add `TxBuilder::build_commitment_transaction`
tankyleo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -544,9 +544,11 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) { | |
let commitment_tx_fee = chan_feerate as u64 * | ||
(chan_utils::commitment_tx_base_weight(&channel_type_features) + 2 * chan_utils::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000; | ||
let anchor_outputs_value = if anchors { 2 * channel::ANCHOR_OUTPUT_VALUE_SATOSHI } else { 0 }; | ||
let amount_satoshis = 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - commitment_tx_fee - anchor_outputs_value - 1; /* msat amount that is burned to fees */ | ||
assert_eq!(sorted_vec(vec![Balance::ClaimableOnChannelClose { | ||
amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - commitment_tx_fee - anchor_outputs_value - 1 /* msat amount that is burned to fees */, | ||
transaction_fee_satoshis: commitment_tx_fee, | ||
amount_satoshis, | ||
// In addition to `commitment_tx_fee`, this also includes the dust HTLC, and the total msat amount rounded down from non-dust HTLCs | ||
transaction_fee_satoshis: 1_000_000 - 4_000 - 3_000 - 1_000 - amount_satoshis - anchor_outputs_value, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably want to update docs. |
||
outbound_payment_htlc_rounded_msat: 3300, | ||
outbound_forwarded_htlc_rounded_msat: 0, | ||
inbound_claiming_htlc_rounded_msat: 0, | ||
|
@@ -598,16 +600,18 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) { | |
let commitment_tx_fee = chan_feerate as u64 * | ||
(chan_utils::commitment_tx_base_weight(&channel_type_features) + | ||
if prev_commitment_tx { 1 } else { 2 } * chan_utils::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000; | ||
let mut a_expected_balances = vec![Balance::ClaimableOnChannelClose { | ||
amount_satoshis: 1_000_000 - // Channel funding value in satoshis | ||
let amount_satoshis = 1_000_000 - // Channel funding value in satoshis | ||
4_000 - // The to-be-failed HTLC value in satoshis | ||
3_000 - // The claimed HTLC value in satoshis | ||
1_000 - // The push_msat value in satoshis | ||
3 - // The dust HTLC value in satoshis | ||
commitment_tx_fee - // The commitment transaction fee with two HTLC outputs | ||
anchor_outputs_value - // The anchor outputs value in satoshis | ||
1, // The rounded up msat part of the one HTLC | ||
transaction_fee_satoshis: commitment_tx_fee, | ||
1; // The rounded up msat part of the one HTLC | ||
let mut a_expected_balances = vec![Balance::ClaimableOnChannelClose { | ||
amount_satoshis, // Channel funding value in satoshis | ||
// In addition to `commitment_tx_fee`, this also includes the dust HTLC, and the total msat amount rounded down from non-dust HTLCs | ||
transaction_fee_satoshis: 1_000_000 - 4_000 - 3_000 - 1_000 - amount_satoshis - anchor_outputs_value, | ||
outbound_payment_htlc_rounded_msat: 3000 + if prev_commitment_tx { | ||
200 /* 1 to-be-failed HTLC */ } else { 300 /* 2 HTLCs */ }, | ||
outbound_forwarded_htlc_rounded_msat: 0, | ||
|
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why cant we use
sum
? Maybe mappingto_sat
in the firstmap
?