Change Prevouts::All(&[TxOut]) to Prevouts::All(&[&TxOut])#835
Change Prevouts::All(&[TxOut]) to Prevouts::All(&[&TxOut])#835apoelstra merged 1 commit intorust-bitcoin:masterfrom
Conversation
|
I'm not convinced by this. This change helps the caller who already has |
Yup, exactly I am not sure how to evaluate this. For the psbt workflow, Having I can also imagine someone asking a full node |
|
IMO we should try generics with |
115e0f6 to
5943e40
Compare
|
@Kixunil, iterator turned out more annoying(requiring exact size iterators and cloning while consuming) and unneeded for this application. But the borrow::Borrow helped a lot. I believe this satisfies my use-case while retaining the current use-case too. |
5943e40 to
27ff05e
Compare
Kixunil
left a comment
There was a problem hiding this comment.
Oh, yeah, Borrow on item in the array looks good!
src/util/sighash.rs
Outdated
There was a problem hiding this comment.
This clone was done because the generic T needed to be the same type across if else arms
There was a problem hiding this comment.
Doesn't matter much in test anyway.
There was a problem hiding this comment.
Yeah, just highlighted because it might confuse review.
There was a problem hiding this comment.
This is kinda unfortunate because it might be a common pattern, but I don't see any sensible way around it.
There was a problem hiding this comment.
The taproot_signature_hash function also gets the correct data for sighash single from prevouts::All. I think it is required to extract the corresponding txout from an array in this fashion. This was only done to test that both of these work.
This avoids some allocation of creating a vec of TxOut to create a slice incase the data is already available in psbt/other methods. Facilitates creation of Prevouts from &[TxOut] as well as &[&TxOut]
27ff05e to
10fedfb
Compare
I believe this avoids some allocation of creating a vec of TxOut to
create a slice incase the data is already available in psbt/other
methods.
See #834