mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 01:40:07 +01:00
e781b66e2f
In this commit, we implement the new BIP 341+342 taproot sighash digest computation. The digest is similar, but re-orders some fragments and also starts to commit to the input values of all the transactions in the SIGHASH_ALL case. A new implicit sighash flag, SIGHASH_DEFAULT has been added that allows signatures to always be 64-bytes for the common case. The hashcache has been updated as well to store both the v0 and v1 mid state hashes. The v0 hashes are a double-sha of the contents, while the v1 hash is a single sha. As a result, if a transaction spends both v0 and v1 inputs, then we 're able to re-use all the intermediate hashes. As the sighash computation needs the input values and scripts, we create an abstraction: the PrevOutFetcher to give the caller flexibility w.r.t how this is done. We also create a `CannedPrevOutputFetcher` that holds the information in a map for a single input. A series of function options are also added to allow re-use of the same base sig hash calculation for both BIP 341 and 342. |
||
---|---|---|
.. | ||
doc.go | ||
go.mod | ||
hash_test.go | ||
hash.go | ||
hashfuncs_test.go | ||
hashfuncs.go | ||
README.md |
chainhash
chainhash provides a generic hash type and associated functions that allows the specific hash algorithm to be abstracted.
Installation and Updating
$ go get -u github.com/btcsuite/btcd/chaincfg/chainhash
GPG Verification Key
All official release tags are signed by Conformal so users can ensure the code has not been tampered with and is coming from the btcsuite developers. To verify the signature perform the following:
-
Download the public key from the Conformal website at https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt
-
Import the public key into your GPG keyring:
gpg --import GIT-GPG-KEY-conformal.txt
-
Verify the release tag with the following command where
TAG_NAME
is a placeholder for the specific tag:git tag -v TAG_NAME
License
Package chainhash is licensed under the copyfree ISC License.