@@ -1183,9 +1183,6 @@ impl PartialEq for PackageTemplate {
1183
1183
}
1184
1184
1185
1185
impl PackageTemplate {
1186
- fn weight ( & self ) -> u64 {
1187
- self . inputs . iter ( ) . map ( |( _, solving_data) | solving_data. weight ( ) ) . sum :: < usize > ( ) as u64
1188
- }
1189
1186
#[ rustfmt:: skip]
1190
1187
pub ( crate ) fn can_merge_with ( & self , other : & PackageTemplate , cur_height : u32 , is_0fc_channel : bool ) -> bool {
1191
1188
match ( self . malleability , other. malleability ) {
@@ -1249,14 +1246,11 @@ impl PackageTemplate {
1249
1246
// MUST be true, otherwise we are aggregating V2 tx claims with V3 tx claims
1250
1247
debug_assert ! ( self . inputs. iter( ) . all( |( _, solving_data) | matches!( solving_data, PackageSolvingData :: HolderHTLCOutput ( _) ) ) ) ;
1251
1248
debug_assert ! ( other. inputs. iter( ) . all( |( _, solving_data) | matches!( solving_data, PackageSolvingData :: HolderHTLCOutput ( _) ) ) ) ;
1252
- // See rust-bitcoin to_vbytes_ceil
1253
- let self_vbytes = ( self . weight ( ) + 3 ) / 4 ; // This is the weight of the witnesses alone, we need to add more here
1254
- let other_vbytes = ( other. weight ( ) + 3 ) / 4 ;
1255
- // What is a good offset to use here to leave room for the user-provided input-output pair?
1256
- // How much validation to do at coin-selection time in bump_transaction mod ?
1257
- // Just warn users in the docs not to use some really heavy witnesses to fee-bump their transactions?
1258
- // A 1-input-1-output p2wpkh-input p2wpkh-input transaction is 109.25vB.
1259
- if self_vbytes + other_vbytes < 10_000 - 200 {
1249
+ // We aggregate max 25 holder HTLC outputs together to avoid hitting the max 10_000vB cap on TRUC singletons.
1250
+ // Note we do not currently aggregate these with the anchor transaction that fee-bumps the 0-fee commitment transaction.
1251
+ // Back-of-the-envelope, this lands us at max HTLC_SUCCESS_TX_WEIGHT.to_vbytes_ceil() * 25 ~= 4500 vB.
1252
+ // You really have to try hard to provide a single 5_000vB input-output pair to fee-bump a 25-HTLC package.
1253
+ if self . inputs . len ( ) + other. inputs . len ( ) <= 25 {
1260
1254
return true ;
1261
1255
}
1262
1256
} else {
0 commit comments