@@ -46,6 +46,10 @@ pub enum ProtocolMessagePartKey {
46
46
/// The ProtocolMessage part key associated to the Cardano stake distribution Merkle root
47
47
#[ serde( rename = "cardano_stake_distribution_merkle_root" ) ]
48
48
CardanoStakeDistributionMerkleRoot ,
49
+
50
+ /// The ProtocolMessage part key associated to the Cardano database Merkle root
51
+ #[ serde( rename = "cardano_database_merkle_root" ) ]
52
+ CardanoDatabaseMerkleRoot ,
49
53
}
50
54
51
55
impl Display for ProtocolMessagePartKey {
@@ -61,6 +65,7 @@ impl Display for ProtocolMessagePartKey {
61
65
Self :: CardanoStakeDistributionMerkleRoot => {
62
66
write ! ( f, "cardano_stake_distribution_merkle_root" )
63
67
}
68
+ Self :: CardanoDatabaseMerkleRoot => write ! ( f, "cardano_database_merkle_root" ) ,
64
69
}
65
70
}
66
71
}
@@ -207,6 +212,20 @@ mod tests {
207
212
assert_ne ! ( hash_expected, protocol_message_modified. compute_hash( ) ) ;
208
213
}
209
214
215
+ #[ test]
216
+ fn test_protocol_message_compute_hash_include_cardano_database_merkle_root ( ) {
217
+ let protocol_message = build_protocol_message_reference ( ) ;
218
+ let hash_expected = protocol_message. compute_hash ( ) ;
219
+
220
+ let mut protocol_message_modified = protocol_message. clone ( ) ;
221
+ protocol_message_modified. set_message_part (
222
+ ProtocolMessagePartKey :: CardanoDatabaseMerkleRoot ,
223
+ "cardano-database-merkle-root-456" . to_string ( ) ,
224
+ ) ;
225
+
226
+ assert_ne ! ( hash_expected, protocol_message_modified. compute_hash( ) ) ;
227
+ }
228
+
210
229
#[ test]
211
230
fn test_protocol_message_compute_hash_include_next_protocol_parameters ( ) {
212
231
let protocol_message = build_protocol_message_reference ( ) ;
@@ -259,6 +278,10 @@ mod tests {
259
278
ProtocolMessagePartKey :: CardanoStakeDistributionMerkleRoot ,
260
279
"cardano-stake-distribution-merkle-root-123" . to_string ( ) ,
261
280
) ;
281
+ protocol_message. set_message_part (
282
+ ProtocolMessagePartKey :: CardanoDatabaseMerkleRoot ,
283
+ "cardano-database-merkle-root-123" . to_string ( ) ,
284
+ ) ;
262
285
263
286
protocol_message
264
287
}
0 commit comments