-
Notifications
You must be signed in to change notification settings - Fork 20
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
refactor: add horizon support to tap-agent #594
Conversation
Signed-off-by: Gustavo Inacio <[email protected]>
Pull Request Test Coverage Report for Build 13059209804Details
💛 - Coveralls |
pub fn as_v1(self) -> Option<tap_graph::SignedReceipt> { | ||
match self { | ||
TapReceipt::V1(receipt) => Some(receipt), | ||
_ => None, | ||
} | ||
} | ||
|
||
pub fn as_v2(self) -> Option<tap_graph::v2::SignedReceipt> { | ||
match self { | ||
TapReceipt::V2(receipt) => Some(receipt), | ||
_ => None, | ||
} | ||
} | ||
|
||
pub fn get_v1_receipt(&self) -> Option<&tap_graph::SignedReceipt> { | ||
match self { | ||
TapReceipt::V1(receipt) => Some(receipt), | ||
_ => None, | ||
} | ||
} | ||
|
||
pub fn get_v2_receipt(&self) -> Option<&tap_graph::v2::SignedReceipt> { | ||
match self { | ||
TapReceipt::V2(receipt) => Some(receipt), | ||
_ => None, | ||
} | ||
} |
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.
Why is this necessary with the v1
v2
separation?
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.
just for Aggregation, it's especially important that we can only aggregate V1 Receipts into V1 Ravs and for V2 as well.
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.
Doesn't the enum handle that? I'm trying to understand how a V2 receipt could match as V1.
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.
How do you suggest doing it?
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.
I'm asking you, why you think this won't work:
pub fn get_receipt(&self) -> &tap_graph::v2::SignedReceipt {
match self {
TapReceipt::V2(receipt) => receipt,
TapReceipt::V1(receipt) => receipt,
}
}
Maybe I'm missing something!
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.
Each one has a different type, the compiler would say tap_graph::SignedReceipt
is not an instance of tap_graph::v2::SignedReceipt
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.
Right, I see that now, the v1
having no similar label threw me.
But do the SignedReceipt
types not implement some shared behavior? But it doesn't have to look so confusing?
No description provided.