Psbt hash preimages (again)#478
Conversation
d5dc1f0 to
81ebc67
Compare
src/util/psbt/error.rs
Outdated
|
|
||
| /// Support hash-preimages in psbt | ||
| #[derive(Debug)] | ||
| pub enum PsbtHash{ |
There was a problem hiding this comment.
nit: According to rust API guidelines , we should not use something like psbt::PsbtHash, so I propose to name this enum HashKeys
There was a problem hiding this comment.
Tbh, I find the current name way more intuitive.
There was a problem hiding this comment.
I think we should keep the current name, and I think that the rust API guidelines should make an exception for the word Hash which is already overloaded a zillion times :P
There was a problem hiding this comment.
So, I had to remove this enum completely in order to support a generic function because then I would need to somehow construct a concrete error type from a generic parameter.
So, now the question is having the macro worth having if get slightly detailed error types? Or should I use go String return type instead.(as implemented in the latest revision).
Edit: Or maybe there is some other way that I cannot think of.
src/util/psbt/macros.rs
Outdated
| } | ||
|
|
||
| #[cfg_attr(rustfmt, rustfmt_skip)] | ||
| macro_rules! impl_psbt_insert_hash_pair { |
There was a problem hiding this comment.
I think we have a need to write a derive crate for this library, since we have tooo many macros all around..
I has nothing to do with this specific PR, just a general thought
|
One small naming nit, otherwise I'm happy with 81ebc67 |
src/util/psbt/error.rs
Outdated
|
|
||
| /// Support hash-preimages in psbt | ||
| #[derive(Debug)] | ||
| pub enum PsbtHash{ |
There was a problem hiding this comment.
Tbh, I find the current name way more intuitive.
src/util/psbt/macros.rs
Outdated
| // macros for serde of hashes | ||
| macro_rules! impl_psbt_hash_de_serialize { | ||
| ($thing:ty) => { | ||
| impl_psbt_hash_serialize!($thing); |
src/util/psbt/macros.rs
Outdated
| } | ||
|
|
||
| #[cfg_attr(rustfmt, rustfmt_skip)] | ||
| macro_rules! impl_psbt_insert_hash_pair { |
There was a problem hiding this comment.
Why exactly is this a macro? Couldn't this be a generic function? If possible (without causing redundancy) I think we should avoid macros.
There was a problem hiding this comment.
I agree. I think this can be turned into a generic function without any redundancy. Will do so
40769d1
c99918f to
096ee5f
Compare
dr-orlovsky
left a comment
There was a problem hiding this comment.
utACK with only minor typos / nits
9b444af to
c2f5743
Compare
|
Rebased an addressed the nits. |
src/util/psbt/map/input.rs
Outdated
There was a problem hiding this comment.
I got a branch for this, but it's like 2 years old :)
Added hash preimages to psbt as per updated bip174
sanket1729
left a comment
There was a problem hiding this comment.
Rebased to fix conflicts and addressed comments from @stevenroose .
d3b3ca8
c2f5743 to
d3b3ca8
Compare
The accidental merge of #465 was reverted by #477. This opens PR is cherry-pick of commits from #465 rebased to master.