celestia_core/abci/response/
commit.rs1use bytes::Bytes;
2
3use crate::{block, prelude::*};
4
5#[doc = include_str!("../doc/response-commit.md")]
6#[derive(Clone, PartialEq, Eq, Debug, Default)]
7pub struct Commit {
8 pub data: Bytes,
13 pub retain_height: block::Height,
15}
16
17tendermint_pb_modules! {
22 use super::Commit;
23
24 impl From<Commit> for pb::abci::ResponseCommit {
25 fn from(commit: Commit) -> Self {
26 Self {
27 data: commit.data,
28 retain_height: commit.retain_height.into(),
29 }
30 }
31 }
32
33 impl TryFrom<pb::abci::ResponseCommit> for Commit {
34 type Error = crate::Error;
35
36 fn try_from(commit: pb::abci::ResponseCommit) -> Result<Self, Self::Error> {
37 Ok(Self {
38 data: commit.data,
39 retain_height: commit.retain_height.try_into()?,
40 })
41 }
42 }
43
44 impl Protobuf<pb::abci::ResponseCommit> for Commit {}
45}