File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -1249,14 +1249,11 @@ impl PackageTemplate {
12491249 // MUST be true, otherwise we are aggregating V2 tx claims with V3 tx claims
12501250 debug_assert ! ( self . inputs. iter( ) . all( |( _, solving_data) | matches!( solving_data, PackageSolvingData :: HolderHTLCOutput ( _) ) ) ) ;
12511251 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 {
1252+ // We aggregate max 25 holder HTLC outputs together to avoid hitting the max 10_000vB cap on TRUC singletons.
1253+ // Note we do not currently aggregate these with the anchor transaction that fee-bumps the 0-fee commitment transaction.
1254+ // Back-of-the-envelope, this lands us at max HTLC_SUCCESS_TX_WEIGHT.to_vbytes_ceil() * 25 ~= 4500 vB.
1255+ // You really have to try hard to provide a single 5_000vB input-output pair to fee-bump a 25-HTLC package.
1256+ if self . inputs . len ( ) + other. inputs . len ( ) <= 25 {
12601257 return true ;
12611258 }
12621259 } else {
Original file line number Diff line number Diff line change @@ -971,6 +971,15 @@ where
971971 assert ! ( signed_tx_fee >= expected_signed_tx_fee) ;
972972 }
973973
974+ // We'll read the 0FC bit from `&[HTLCDescriptor]` above once the testing PR lands
975+ if htlc_tx. vsize ( ) > 10_000 {
976+ log_error ! (
977+ self . logger,
978+ "0FC HTLC transaction is too big, make the input-output pair you provided smaller"
979+ ) ;
980+ return Err ( ( ) ) ;
981+ }
982+
974983 log_info ! ( self . logger, "Broadcasting {}" , log_tx!( htlc_tx) ) ;
975984 self . broadcaster . broadcast_transactions ( & [ & htlc_tx] ) ;
976985 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments