compute base output key using secp256k1_ec_pubkey_tweak_add
#1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Calculating$P_k = B_{spend} + t_k * G$ (being called "base output key" in this code base) can be done in one shot using the function for additive pubkey tweaking (-> tweak B_spend with t_k), which is simpler and should also be slightly faster than multiplying and adding up successively.
I came across this code in the course of investigating existing BIP-352 implementations w.r.t. scanning, trying to find a proper approach for a new secp256k1 "silentpayments" module (bitcoin-core/secp256k1#1765).