File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -875,9 +875,15 @@ where
875
875
// Cap the size of transactions claiming `HolderHTLCOutput` in 0FC channels.
876
876
// Otherwise, we could hit the max 10_000vB size limit on V3 transactions
877
877
// (BIP 431 rule 4).
878
- chan_utils:: TRUC_MAX_WEIGHT
878
+ chan_utils:: MAX_TRUC_WEIGHT
879
879
} else {
880
- u64:: MAX
880
+ // We should never hit this because HTLC-timeout transactions have a signed
881
+ // locktime, HTLC-success transactions do not, and we never aggregate
882
+ // packages with a signed locktime with packages that do not have a signed
883
+ // locktime.
884
+ // Hence in the worst case, we aggregate 483 success HTLC transactions,
885
+ // and 483 * 705 ~= 341_000, and 341_000 < 400_000.
886
+ chan_utils:: MAX_STANDARD_TX_WEIGHT
881
887
} ;
882
888
let mut broadcasted_htlcs = 0 ;
883
889
let mut batch_size = htlc_descriptors. len ( ) - broadcasted_htlcs;
Original file line number Diff line number Diff line change @@ -96,8 +96,11 @@ pub const P2A_ANCHOR_INPUT_WITNESS_WEIGHT: u64 = 1;
96
96
/// The maximum value of a P2A anchor.
97
97
pub const P2A_MAX_VALUE : u64 = 240 ;
98
98
99
- /// The maximum weight of a TRUC transaction.
100
- pub const TRUC_MAX_WEIGHT : u64 = 10_000 * WITNESS_SCALE_FACTOR as u64 ;
99
+ /// The maximum weight of a TRUC transaction, see BIP431
100
+ pub const MAX_TRUC_WEIGHT : u64 = 10_000 * WITNESS_SCALE_FACTOR as u64 ;
101
+
102
+ /// The maximum weight of any standard transaction, see bitcoin/src/policy/policy.h
103
+ pub const MAX_STANDARD_TX_WEIGHT : u64 = 400_000 ;
101
104
102
105
/// The upper bound weight of an HTLC timeout input from a commitment transaction with keyed anchor outputs.
103
106
pub const HTLC_TIMEOUT_INPUT_KEYED_ANCHOR_WITNESS_WEIGHT : u64 = 288 ;
You can’t perform that action at this time.
0 commit comments