-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a WtxId struct, and use it in Zebra's external network protocol #2618
Conversation
And derive `Hash`, just like transaction IDs. Don't derive `serde` for now, because it's not needed.
4d08bec
to
fd803c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I liked the new code()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/// [ZIP-244]: https://zips.z.cash/zip-0244.. | ||
#[derive(Copy, Clone, Eq, PartialEq, Debug)] | ||
/// Note: Zebra displays transaction and block hashes in big-endian byte-order, | ||
/// following the u256 convention set by Bitcoin and zcashd. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
let mut reversed_bytes = self.0; | ||
reversed_bytes.reverse(); | ||
f.write_str(&hex::encode(&reversed_bytes)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// TODO: Actually handle this variant once the mempool is implemented | ||
Wtx([u8; 64]), | ||
// TODO: Actually handle this variant once the mempool is implemented (#2449) | ||
Wtx(transaction::WtxId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Motivation
In order to handle wide transaction IDs from the network, Zebra needs to:
id
andauth_data
fieldsinv
,getdata
, andnotfound
messages)Specifications
https://zips.z.cash/zip-0239#specification
Solution
Changes
WtxId
type for wide transaction IDsWtxId
type in external network protocol messagesBug Fixes
AuthDigest
display order match transaction IDsTests
transaction::Hash
test to tests moduleThis is part of ticket #2449, but it does not close that ticket.
Review
Anyone can review this PR.
It's blocking all of the mempool work that needs wide transaction IDs.
It's based on PR #2547, so it might need rebasing after that PR merges to
main
.Reviewer Checklist
Follow Up Work
Create an
UnminedTxId
enum, to abstract over unmined v4 and v5 transactions in Zebra's internal network protocolUnminedTxId
is also blocking all of the mempool work that needs wide transaction IDsThis change is