Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix InputWeightPrediction::P2WPKH_MAX constant DER sig length #2213

Merged
merged 3 commits into from
Nov 22, 2023

Commits on Nov 21, 2023

  1. add weight method to InputWeightPrediction

    This method computes the weight an InputWeightPrediction
    would to a transaction, not including witness flag bytes.
    conduition committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    b5ce219 View commit details
    Browse the repository at this point in the history
  2. Fix the InputWeightPrediction constants for DER signatures

    The P2WPKH_MAX constant assumed DER signatures in the witness have
    a max length of 73. However, their maximum length in practice is 72,
    because BIP62 forbids nodes from relaying transactions whose ECDSA
    signatures are not canonical (i.e. all sigs must have an s value of
    less than n/2). This means s is never encoded with a leading zero
    byte, and the signature as a whole never exceeds 72 bytes in total
    encoded length. The ground_p2wpkh function was already correct;
    only the constant needed to be corrected.
    conduition committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    4514a80 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2023

  1. Add test for input weight predictions

    Sanity checks the InputWeightPrediction against
    a transaction which uses P2WPKH inputs.
    conduition committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    f41ebc2 View commit details
    Browse the repository at this point in the history