Skip to content

Commit 3da20b9

Browse files
committed
Add previous_hash field to /certificate_pending, relates to #112
1 parent 2decb43 commit 3da20b9

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

mithril-network/mithril-aggregator/src/entities.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ pub struct CertificatePending {
4343
#[serde(rename = "protocol")]
4444
pub protocol_parameters: ProtocolParameters,
4545

46+
/// Hash of the previous certificate
47+
#[serde(rename = "previous_hash")]
48+
pub previous_hash: String,
49+
4650
/// Current Signers with stakes
4751
#[serde(rename = "signers")]
4852
pub signers: Vec<SignerWithStake>,
@@ -53,11 +57,13 @@ impl CertificatePending {
5357
pub fn new(
5458
beacon: Beacon,
5559
protocol_parameters: ProtocolParameters,
60+
previous_hash: String,
5661
signers: Vec<SignerWithStake>,
5762
) -> CertificatePending {
5863
CertificatePending {
5964
beacon,
6065
protocol_parameters,
66+
previous_hash,
6167
signers,
6268
}
6369
}

mithril-network/mithril-aggregator/src/fake_data.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ pub(crate) fn certificate_pending() -> entities::CertificatePending {
2626
// Protocol parameters
2727
let protocol_parameters = protocol_parameters();
2828

29+
// Previous hash
30+
let previous_hash = "123".to_string();
31+
2932
// Signers with stakes
3033
let signers = signers_with_stakes(5);
3134

3235
// Certificate pending
33-
entities::CertificatePending::new(beacon, protocol_parameters, signers)
36+
entities::CertificatePending::new(beacon, protocol_parameters, previous_hash, signers)
3437
}
3538

3639
/// Fake Certificate

mithril-network/openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,17 @@ components:
231231
required:
232232
- beacon
233233
- protocol
234+
- previous_hash
234235
- signers
235236
properties:
236237
beacon:
237238
$ref: '#/components/schemas/Beacon'
238239
protocol:
239240
$ref: '#/components/schemas/ProtocolParameters'
241+
previous_hash:
242+
description: Hash of the previous certificate
243+
type: string
244+
format: bytes
240245
signers:
241246
type: array
242247
items:

0 commit comments

Comments
 (0)