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;
37
37
use bitcoin:: secp256k1:: { PublicKey , Secp256k1 } ;
38
38
use bitcoin:: secp256k1:: ecdsa:: Signature ;
39
39
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 ;
41
41
42
42
const BASE_INPUT_SIZE : u64 = 32 /* txid */ + 4 /* vout */ + 4 /* sequence */ ;
43
43
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 ;
45
45
46
46
/// The parameters required to derive a channel signer via [`SignerProvider`].
47
47
#[ derive( Clone , Debug , PartialEq , Eq ) ]
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ use crate::sign::EntropySource;
21
21
use core:: ops:: Deref ;
22
22
use std:: io:: sink;
23
23
use bitcoin:: consensus:: Encodable ;
24
+ use crate :: events:: bump_transaction:: { BASE_INPUT_WEIGHT , EMPTY_SCRIPT_SIG_WEIGHT } ;
24
25
use crate :: util:: ser:: TransactionU16LenLimited ;
25
26
26
27
/// The number of received `tx_add_input` messages during a negotiation at which point the
@@ -320,11 +321,8 @@ impl NegotiationContext {
320
321
return Err ( AbortReason :: TransactionTooLarge ) ;
321
322
}
322
323
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 ;
328
326
329
327
// - the peer's paid feerate does not meet or exceed the agreed feerate (based on the minimum fee).
330
328
let counterparty_output_weight_contributed: u64 = counterparty_outputs_contributed. clone ( ) . map ( |output|
You can’t perform that action at this time.
0 commit comments