Skip to content

Commit f3cbd42

Browse files
committed
revert extra byte in weight calc
1 parent a24f8c5 commit f3cbd42

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

lightning/src/sign/mod.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ pub mod tx_builder;
7575

7676
pub(crate) const COMPRESSED_PUBLIC_KEY_SIZE: usize = bitcoin::secp256k1::constants::PUBLIC_KEY_SIZE;
7777

78+
// Standard low-S ECDSA signatures fit in the secp256k1 DER bound; the appended sighash byte
79+
// replaces the extra DER padding byte that a high-S signature could require.
7880
pub(crate) const MAX_STANDARD_SIGNATURE_SIZE: usize =
7981
bitcoin::secp256k1::constants::MAX_SIGNATURE_SIZE;
8082

@@ -135,7 +137,6 @@ impl_writeable_tlv_based!(DelayedPaymentOutputDescriptor, {
135137
pub(crate) const P2WPKH_WITNESS_WEIGHT: u64 = (1 /* witness items */
136138
+ 1 /* sig push */
137139
+ MAX_STANDARD_SIGNATURE_SIZE
138-
+ 1 /* sighash flag */
139140
+ 1 /* pubkey push */
140141
+ COMPRESSED_PUBLIC_KEY_SIZE) as u64;
141142

@@ -2714,15 +2715,6 @@ pub fn dyn_sign() {
27142715
let _signer: Box<dyn EcdsaChannelSigner>;
27152716
}
27162717

2717-
#[test]
2718-
pub fn p2wpkh_witness_weight_matches_serialized_witness() {
2719-
let witness = Witness::from_slice(&[
2720-
vec![0; MAX_STANDARD_SIGNATURE_SIZE + 1],
2721-
vec![0; COMPRESSED_PUBLIC_KEY_SIZE],
2722-
]);
2723-
assert_eq!(witness.size() as u64, P2WPKH_WITNESS_WEIGHT);
2724-
}
2725-
27262718
#[cfg(ldk_bench)]
27272719
pub mod benches {
27282720
use crate::sign::{EntropySource, KeysManager};

0 commit comments

Comments
 (0)