Use TapTweakHash::from_key_and_tweak() method in computing tweak for UntweakedPublicKey#697
Use TapTweakHash::from_key_and_tweak() method in computing tweak for UntweakedPublicKey#697dr-orlovsky merged 1 commit intorust-bitcoin:masterfrom nlanson:master
Conversation
dr-orlovsky
left a comment
There was a problem hiding this comment.
utACK 9e2bad304c36cd2d314db11b31d11be3b8f703c7
sanket1729
left a comment
There was a problem hiding this comment.
ACK 9e2bad304c36cd2d314db11b31d11be3b8f703c7
src/util/schnorr.rs
Outdated
There was a problem hiding this comment.
schnorr::PublicKey is Copy, I think it is the same.
There was a problem hiding this comment.
In that case .clone() is redundant and I don't think it should be used.
There was a problem hiding this comment.
TapTweakHash::from_key_and_tweak(...) takes in schnorrsig::PublicKey where as the function it is being called in has &UntweakedPublicKey.
I used the .clone() to get around the borrow checker.
Should I instead pass in *self to the method or should I modify TapTweakHash::from_key_and_tweak(...) to take in &schnorrsig::PublicKey as a parameter? Or maybe I can change tap_tweak(...) to consume self?
There was a problem hiding this comment.
I think taking self by value everywhere is the correct approach. The compiler should insert references for optimization if needed.
There was a problem hiding this comment.
Fixed in the latest commit and squashed.
Requesting to remove the clone as KixUnil suggested
e4774e7 fixups to taptweaking code (sanket1729) Pull request description: This was my bad for not clearly stating the expected spec #687 . Changed values to references so that we only take ownership where it is required. This should simplify the #697 ACKs for top commit: Kixunil: ACK e4774e7 dr-orlovsky: utACK e4774e7 Tree-SHA512: adacbfa8a77f46b2c85720f3760ed12a437f40d8422731d0207662d7947c95dda79d576923f6056c77f57977a3dcd25afd270f0ee11e9c3be9d067ccdc63371a
|
Needs rebase |
|
I have tried to rebase but noticed that in #707 , the Should |
|
Generally I think we should take |
|
Updated the following methods to take
|
|
ACK 5b21a9c (sorry for forgetting to add this into approve message - IDK if relevant) |
Quick follow up PR to #691 using a method from #677.
Changes
UntweakedPublicKey::tap_tweak(...)to useTapTweakHash::from_key_and_tweak(...)