File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,11 @@ use bitcoin::secp256k1;
3737use bitcoin:: secp256k1:: { PublicKey , Secp256k1 } ;
3838use bitcoin:: secp256k1:: ecdsa:: Signature ;
3939
40- const EMPTY_SCRIPT_SIG_WEIGHT : u64 = 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 ;
40+ pub ( crate ) const EMPTY_SCRIPT_SIG_WEIGHT : u64 = 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 ;
4141
4242const BASE_INPUT_SIZE : u64 = 32 /* txid */ + 4 /* vout */ + 4 /* sequence */ ;
4343
44- const BASE_INPUT_WEIGHT : u64 = BASE_INPUT_SIZE * WITNESS_SCALE_FACTOR as u64 ;
44+ pub ( crate ) const BASE_INPUT_WEIGHT : u64 = BASE_INPUT_SIZE * WITNESS_SCALE_FACTOR as u64 ;
4545
4646/// The parameters required to derive a channel signer via [`SignerProvider`].
4747#[ derive( Clone , Debug , PartialEq , Eq ) ]
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ use crate::sign::EntropySource;
2121use core:: ops:: Deref ;
2222use std:: io:: sink;
2323use bitcoin:: consensus:: Encodable ;
24+ use crate :: events:: bump_transaction:: { BASE_INPUT_WEIGHT , EMPTY_SCRIPT_SIG_WEIGHT } ;
2425use crate :: util:: ser:: TransactionU16LenLimited ;
2526
2627/// The number of received `tx_add_input` messages during a negotiation at which point the
@@ -320,11 +321,8 @@ impl NegotiationContext {
320321 return Err ( AbortReason :: TransactionTooLarge ) ;
321322 }
322323
323- // TODO:
324- // - Use existing rust-lightning/rust-bitcoin constants.
325- // - How do we enforce their fees cover the witness without knowing its expected length?
326- // - Read eclair's code to see if they do this?
327- const INPUT_WEIGHT : u64 = ( 32 + 4 + 4 ) * WITNESS_SCALE_FACTOR as u64 ;
324+ // TODO: How do we enforce their fees cover the witness without knowing its expected length?
325+ const INPUT_WEIGHT : u64 = BASE_INPUT_WEIGHT + EMPTY_SCRIPT_SIG_WEIGHT ;
328326
329327 // - the peer's paid feerate does not meet or exceed the agreed feerate (based on the minimum fee).
330328 let counterparty_output_weight_contributed: u64 = counterparty_outputs_contributed. clone ( ) . map ( |output|
You can’t perform that action at this time.
0 commit comments