Merge rust-bitcoin/rust-bitcoin#4114: Policy: Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65

2fe3687899 Policy: Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65 (jrakibi)

Pull request description:

  Align with Bitcoin Core's policy by reducing the minimum non-witness transaction size from 82 to 65 bytes.
  This will allow for more minimal transaction cases (eg: 1 input with 1 OP_RETURN output) while maintaining protection against CVE-2017-12842.

  The 65-byte minimum consists of:
  - 60 bytes: minimal tx (10B skeleton + 41B input + 9B output)
  ```
  # Tx Skeleton: 4 [Version] + 1 [InCount] + 1 [OutCount] + 4 [LockTime] = 10 bytes
  # Blank Input: 32 [PrevTxHash] + 4 [Index] + 1 [scriptSigLen] + 4 [SeqNo] = 41 bytes
  # Output:      8 [Amount] + 1 [scriptPubKeyLen] = 9 bytes
  ```

  - 5 bytes: minimum `scriptPubKey`

  Closes https://github.com/rust-bitcoin/rust-bitcoin/issues/4108

ACKs for top commit:
  tcharding:
    ACK 2fe3687899
  Kixunil:
    ACK 2fe3687899

Tree-SHA512: d98fae7ebde5060c7ad8a3555df094e8ed93486c371b1bd43302bbd1b6b2d86c442803dcbcc5b30f3692224a888abc4e49b7b5414d9852317730628a139fbd40
This commit is contained in:
merge-script 2025-03-01 03:35:47 +00:00
commit ea56619df5
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 2 additions and 2 deletions

View File

@ -18,8 +18,8 @@ use super::constants::{MAX_BLOCK_SIGOPS_COST, WITNESS_SCALE_FACTOR};
/// Maximum weight of a transaction for it to be relayed by most nodes on the network
pub const MAX_STANDARD_TX_WEIGHT: u32 = 400_000;
/// Minimum non-witness size for a standard transaction (1 SegWit input + 1 P2WPKH output = 82 bytes)
pub const MIN_STANDARD_TX_NONWITNESS_SIZE: u32 = 82;
/// Minimum non-witness size for a standard transaction, set to 65 bytes.
pub const MIN_STANDARD_TX_NONWITNESS_SIZE: u32 = 65;
/// Maximum number of sigops in a standard tx.
pub const MAX_STANDARD_TX_SIGOPS_COST: u32 = MAX_BLOCK_SIGOPS_COST as u32 / 5;