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

multi: update main package and btcutil to chainhash/v1.1.0, use optimized dsha256 #2075

Merged
merged 5 commits into from
Dec 19, 2023

Commits on Dec 19, 2023

  1. Configuration menu
    Copy the full SHA
    4126760 View commit details
    Browse the repository at this point in the history
  2. multi: update main package to chainhash/v1.1.0, use optimized dsha256

    In this commit, we update the top-level btcd package to use the latest
    version of btcutil and also the chainhash package. With this version
    bump, we can now use the new optimized dsha256 routine where applicable.
    
    With this commit, I've covered most of the areas we'll hash an entire
    transaction/block/header, but we may want to optimize some other areas
    further, in particular, the witness sighash calc.
    Roasbeef committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    c3c3545 View commit details
    Browse the repository at this point in the history
  3. txscript: use DoubleHashRaw to write directly crypto.Hash for segwit …

    …sighash
    
    In this commit, we optimize the sighash calc further by writing directly
    into the buffer used for serialization by the sha256.New() instance
    rather than to an intermediate buffer, which is then write to the hash
    buffer.
    Roasbeef committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    adfb641 View commit details
    Browse the repository at this point in the history
  4. txscript: use DoubleHashRaw for segwit sighash single calc

    We can write direly into the hash writer vs serializing into a buffer,
    then writing that into the hash writer.
    Roasbeef committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    046a701 View commit details
    Browse the repository at this point in the history
  5. txscript: use a single shared scratch buffer in segwit sighash calc

    We used to use a lot of small buffers for serialization, but now we'll
    use one buffer large enough, and slice into it when needed.
    
    ``
    name                  old time/op    new time/op    delta
    CalcWitnessSigHash-8    31.5µs ± 0%    29.2µs ± 0%   -7.05%  (p=0.000 n=10+10)
    
    name                  old alloc/op   new alloc/op   delta
    CalcWitnessSigHash-8    19.9kB ± 0%    18.5kB ± 0%   -7.14%  (p=0.000 n=10+10)
    
    name                  old allocs/op  new allocs/op  delta
    CalcWitnessSigHash-8       801 ± 0%       445 ± 0%  -44.44%  (p=0.000 n=10+10)
    ```
    Roasbeef committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    19008ed View commit details
    Browse the repository at this point in the history