-
Notifications
You must be signed in to change notification settings - Fork 228
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
first take at hooking up a node #117
first take at hooking up a node #117
Conversation
tendermint-lite/src/main.rs
Outdated
@@ -0,0 +1,134 @@ | |||
use tendermint::hash::Algorithm; |
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.
Perhaps it would be less ambiguous to import tendermint::hash
and reference Algorithm
as hash::Algorithm
?
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.
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'd say it's both more explicit and good futureproofing in the event you do ever want to support additional hash algorithms. I'll cite git
as a project which didn't do this which also still hasn't managed to migrate to a new hash algorithm.
That said I doubt SHA-256 will ever be catastrophically broken.
let mut height_opt = Some(height); | ||
if height.value() == 0 { | ||
height_opt = None | ||
} | ||
Self { height: height_opt } |
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'd probably write this like:
Self {
height: match height.value() {
0 => None,
_ => Some(height)
}
}
Alternatively perhaps define a method on Height
for this? It seems useful.
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.
This was a shortcut to get the integration to work. There ought to be a more explicit way to request the latest height that depending on the implicit menaing of 0
.
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.
Addressed in 7477c9d
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.
Opened an issue for this #118
First take at hooking it all up into a running light node!
It currently fails I think because we're computing header hashes incorrectly ...