aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2024-08-06 21:31:35 -0400
committerRyan Ofsky <ryan@ofsky.org>2024-08-06 22:10:02 -0400
commitb38fb19b7eed952726a8b858de3f0533c867fc90 (patch)
tree5e65ca32923d3b6742367708aeb9462cf7aceaec /src/sync.h
parentce1c881ccc8ff9017099352fd4f66d0554338d61 (diff)
parentec973dd19719541dbcd6f3a6facf6f5dd7cf439c (diff)
Merge bitcoin/bitcoin#30051: crypto, refactor: add new KeyPair class
ec973dd19719541dbcd6f3a6facf6f5dd7cf439c refactor: remove un-tested early returns (josibake) 72a5822d43d47431b2838ebfcb1f2e21210f5ccb tests: add tests for KeyPair (josibake) cebb08b121ce8c4c5e68bd043b8668c106e31169 refactor: move SignSchnorr to KeyPair (josibake) c39fd39ba868253b5118db2e1ac1461d29f0b4ce crypto: add KeyPair wrapper class (josibake) 5d507a0091da1b6c013b00b6c76e19dd4d3b93a7 tests: add key tweak smoke test (josibake) f14900b6e4eac26ae5f1c0badfa176d895851c97 bench: add benchmark for signing with a taptweak (josibake) Pull request description: Broken out from #28201 --- The wallet returns an untweaked internal key for taproot outputs. If the output commits to a tree of scripts, this key needs to be tweaked with the merkle root. Even if the output does not commit to a tree of scripts, BIP341/342 recommend commiting to a hash of the public key. Previously, this logic for applying the taptweak was implemented in the `CKey::SignSchnorr` method. This PR moves introduces a KeyPair class which wraps a `secp256k1_keypair` type and refactors SignSchnorr to use this new KeyPair. The KeyPair class is created with an optional merkle_root argument and the logic from BIP341 is applied depending on the state of the merkle_root argument. The motivation for this refactor is to be able to use the tap tweak logic outside of signing, e.g. in silent payments when retrieving the private key (see #28201). Outside of silent payments, since we almost always convert a `CKey` to a `secp256k1_keypair` when doing anything with taproot keys, it seems generally useful to have a way to model this type in our code base. ACKs for top commit: paplorinc: ACK ec973dd19719541dbcd6f3a6facf6f5dd7cf439c - will happily reack if you decide to apply @ismaelsadeeq's suggestions ismaelsadeeq: Code review ACK ec973dd19719541dbcd6f3a6facf6f5dd7cf439c itornaza: trACK ec973dd19719541dbcd6f3a6facf6f5dd7cf439c theStack: Code-review ACK ec973dd19719541dbcd6f3a6facf6f5dd7cf439c Tree-SHA512: 34947e3eac39bd959807fa21b6045191fc80113bd650f6f08606e4bcd89aa17d6afd48dd034f6741ac4ff304b104fa8c1c1898e297467edcf262d5f97425da7b
Diffstat (limited to 'src/sync.h')
0 files changed, 0 insertions, 0 deletions