PSBT taproot spending signature type#671
PSBT taproot spending signature type#671dr-orlovsky wants to merge 2 commits intorust-bitcoin:masterfrom BP-WG:psbt/taproot
Conversation
containing both signature and SigHash, serializing according to the consensus (for witness field) and PSBT (for taproot signature keys) rules
| pub fn sighash_byte(self) -> u8 { | ||
| self.sighash_type as u8 | ||
| } | ||
|
|
There was a problem hiding this comment.
Because self is Copy - and, according to rust API guidelines, copy-types should consume self, rather than taking it by ref.
The rationale is quite simple: Self here is 8 bit, reference is 64 bit.
There was a problem hiding this comment.
Because self is Copy - and, according to rust API guidelines, copy-types should consume self, rather than taking it by ref.
Interesting, thanks I did not know that.
The rationale is quite simple: Self here is 8 bit, reference is 64 bit.
self here is SpendingSignature not 8 bit, but it is Copy :)
There was a problem hiding this comment.
Oh right. We had this discussion before, that pushing 32 bytes to stack in function call may be still cheaper than 64-bit pointer + memory access
There was a problem hiding this comment.
More importantly, the compiler can do these optimizations better than all of us combined. Passing via value or reference should be mostly semantics, not an optimization.
|
Should be rebased in top of #681 |
|
I will open a PR to address #670 first that should address this |
No description provided.