1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
use crate::{account, block, chain, Hash, Time};
#[cfg(feature = "serde")]
use {
crate::serializers,
serde::{Deserialize, Serialize},
};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug)]
pub struct Header {
pub version: Version,
pub chain_id: chain::Id,
pub height: block::Height,
pub time: Time,
#[cfg_attr(
feature = "serde",
serde(
serialize_with = "serializers::serialize_u64",
deserialize_with = "serializers::parse_u64"
)
)]
pub num_txs: u64,
#[cfg_attr(
feature = "serde",
serde(
serialize_with = "serializers::serialize_u64",
deserialize_with = "serializers::parse_u64"
)
)]
pub total_txs: u64,
pub last_block_id: block::Id,
pub last_commit_hash: Hash,
pub data_hash: Hash,
pub validators_hash: Hash,
pub next_validators_hash: Hash,
pub consensus_hash: Hash,
pub app_hash: Hash,
pub last_results_hash: Hash,
pub evidence_hash: Hash,
pub proposer_address: account::Id,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug)]
pub struct Version {
#[cfg_attr(
feature = "serde",
serde(
serialize_with = "serializers::serialize_u64",
deserialize_with = "serializers::parse_u64"
)
)]
pub block: u64,
#[cfg_attr(
feature = "serde",
serde(
serialize_with = "serializers::serialize_u64",
deserialize_with = "serializers::parse_u64"
)
)]
pub app: u64,
}