-
Notifications
You must be signed in to change notification settings - Fork 224
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
impl lite::Commit for commit::SignedHeader #67
impl lite::Commit for commit::SignedHeader #67
Conversation
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.
@@ -1,6 +1,6 @@ | |||
//! `/commit` endpoint JSONRPC wrapper | |||
|
|||
use crate::{block, rpc}; | |||
use crate::{amino_types::vote::CanonicalVote, block, lite, rpc, vote::SignedVote, Hash}; |
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.
The rpc module currently does not depend on amino_types
. I think, if possible, we should try to keep it that way. Even if that means introducing another type under tendermint/block (or similar).
Did the suggested changes here: e1a7560 |
Great, thanks. |
let chain_id = self.header.chain_id.to_string(); | ||
let mut votes = self.commit.precommits.clone().into_vec(); | ||
votes | ||
.drain(..) |
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.
@yihuang Why use drain
here rather than iter
?
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.
Yeah, my fault, not familiar enough with idiomatic rust then. But I believe this code already modified by @liamsi in the final merged version ;D
Implements the
lite::Commit
trait on thecommit::SignedHeader
struct. This may sound a bit confusing as there also is acommit::Commit
struct. The latter does not now about the chain-id and hence we use the SignedHeader's header to fill in the chain-ids into the votes (which implmentsSignedVote
).(Description added by @liamsi)