Manually implement serde traits for OutPoint - #4933
Conversation
|
Hand written, no vibe coded junk. lol, 'hand written' - I cannot believe we have to say that now. |
b9cfdd8 to
a460b6a
Compare
| // serializing as an array was found in the past to break for some serializers so we use | ||
| // a slice instead. This causes 8 bytes to be prepended for the length (even though this | ||
| // is a bit silly because know the length). | ||
| state.serialize_field("txid", &self.txid.as_byte_array()[..])?; |
There was a problem hiding this comment.
Maybe .as_slice(), instead of &x[..]? It's few characters longer, but expresses the intention well matching the comment? I donno, just a thought while scanning through it.
There was a problem hiding this comment.
Agreed (though if this is the only thing in this PR I won't hold it up for it).
For the most part throughout this crate we us &x[..] because for the most part it doesn't matter .. but in this case we're being deliberate about the slice vs array-ref distunction.
a460b6a to
bf38408
Compare
|
TODO: Woops, note to self, remove first patch. I gotta dash rn |
bf38408 to
6c5628c
Compare
|
Force push, after fixing, is just usage of |
|
Needs rebase. |
6c5628c to
4d549cc
Compare
|
Rebase only, fixed conflicts in imports. |
|
4d549cc looks good, but can you add a fixed test vector for (Sorry, I meant to post this a week ago, but got halfway through typing it and tabbed away..) |
4d549cc to
681338d
Compare
681338d to
967f653
Compare
|
No stress, done. |
|
The new tests do not compile :). |
This is likely (hopefully) tested elsewhere but in preparation for manually implementing serde traits for `OutPoint` add deserialization and roundtrip tests for both human and non-human readable.
Reading Rust macros makes my eyes bleed - the `internals::serde_struct_human_string_impl` is a great example. The macro is used in exactly one place, for `OutPoint`. Implement `serde` stuff for `OutPoint` and remove `serde_struct_human_string_impl` - death to all macros.
967f653 to
42d3039
Compare
|
Goodness me that was a mess, add IOU one whiskey to your tally. |
Death to all macros.
This was pulled out of #4902, review suggestions over there are relevant. Also I started #4932 after working on this.