-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #628: Adds Taproot BIP341 signature message and create a unifie…
…d sighash cache for legacy, segwit and taproot inputs c704ee7 [docs-only] Use backtick in addition to square parentheses for types references, clarify legacy, non_exhaustive comment, remove std:: (Riccardo Casatta) f223be6 Rename access_witness to witness_mut and return Option (Riccardo Casatta) c9bc0b9 [fmt-only] autoformatting with `rustfmt src/util/sighash.rs` (Riccardo Casatta) 0777491 Use get_or_insert_with in segwit_cache (Martin Habovstiak) 497dbfb Use get_or_insert_with in common_cache() (Martin Habovstiak) ca80a5a Use get_or_insert_with in taproot_cache (Martin Habovstiak) 6e06a32 Wrap ErrorKind in Io enum variant, fix doc comment for the IO variant (Riccardo Casatta) 1a2b54f introduce constant KEY_VERSION_0 (Riccardo Casatta) 417cfe3 Derive common traits for structs and enum, make internal struct not pub (Riccardo Casatta) 55ce3dd Fix validation error if SINGLE with missing corresponding output, remove check_index and check with get().ok_or(), more details in errors (Riccardo Casatta) 2b3b22f impl Encodable for Annex to avoid allocation (Riccardo Casatta) 1a7afed Add Reserved variant to SigHashType for future use (ie SIGHASH_ANYPREVOUT) (Riccardo Casatta) 53d0e17 Deprecate bip143::SigHashCache in favor of sighash::SigHashCache (Riccardo Casatta) 15e3caf [test] Test also sighash legacy API with legacy tests (Riccardo Casatta) 24acfe3 Implement Bip341 signature hash, create unified SigHashCache for taproot, segwit and legacy inputs (Riccardo Casatta) 683b9c1 add [En|De]codable trait for sha256::Hash (Riccardo Casatta) Pull request description: Adds https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki message signature algorithm The base is taken from `bip143::SigHashCache`, some code results duplicated but I think it's more clear to keep things separated Would mark some bullet point on #503 Test vectors are taken by running https://github.com/bitcoin/bitcoin/blob/d1e4c56309aeb73772e3a9d779a9c157024c9e1e/test/functional/feature_taproot.py with a modified `TaprootSignatureHash` function to print intermediate values that I cannot found in the bip341 [test vector json](https://raw.githubusercontent.com/bitcoin-core/qa-assets/main/unit_test_data/script_assets_test.json) UPDATE: Latest version includes the suggestion from @sanket1729 to create a unified tool for signature message hash for legacy, segwit, and taproot inputs. In particular, makes sense for mixed segwit v0 and taproot v1 inputs because cached values could be shared ACKs for top commit: sanket1729: ACK c704ee7. Reviewed the diff from a37de1a which I previously ACKed dr-orlovsky: utACK c704ee7 by diffing it to 6e06a32 having my ACK before. apoelstra: ACK c704ee7 Tree-SHA512: 35530995fe9d078acd0178cfca654ca980109f4502c91d578c1a0d5c6cafacab7db1ffd6216288eac99f6a763776cbc0298cfbdff00b5a83e98ec4b15aa764e8
- Loading branch information
Showing
5 changed files
with
952 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.