Skip to content

Commit af67e03

Browse files
committed
Create an empty CardanoDbBeacon to be used as a placeholder
1 parent 75abdfe commit af67e03

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ As a minor extension, we have adopted a slightly different versioning convention
2525

2626
- Add prettier configuration to standardize the code formatting in the repository.
2727

28-
- Field `beacon` become optional in `CertificatePendingMessage` response of `/certificate-pending` route.
28+
- Field `beacon` becomes optional in `CertificatePendingMessage` response of `/certificate-pending` route.
2929

3030
- **UNSTABLE** Cardano transactions certification:
3131

mithril-aggregator/src/http_server/routes/certificate_routes.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ mod tests {
122122
use anyhow::anyhow;
123123
use mithril_common::{
124124
entities::CertificatePending,
125-
messages::CertificatePendingMessage,
126125
test_utils::{apispec::APISpec, fake_data},
127126
};
128127
use mithril_persistence::store::adapter::DumbStoreAdapter;

mithril-aggregator/src/message_adapters/to_certificate_pending_message.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ pub struct ToCertificatePendingMessageAdapter;
1010
impl ToCertificatePendingMessageAdapter {
1111
/// Method to trigger the conversion
1212
pub fn adapt(certificate_pending: CertificatePending) -> CertificatePendingMessage {
13+
#[allow(deprecated)]
1314
let beacon = match &certificate_pending.signed_entity_type {
1415
SignedEntityType::CardanoImmutableFilesFull(beacon) => beacon.clone(),
15-
_ => CardanoDbBeacon::new("", 0, 0),
16+
_ => CardanoDbBeacon::empty(),
1617
};
1718

1819
#[allow(deprecated)]
@@ -68,7 +69,7 @@ mod tests {
6869
#[test]
6970
fn adapt_on_cardano_immutable_files_full_signed_entity_type_ok() {
7071
let mut certificate_pending = fake_data::certificate_pending();
71-
let beacon = CardanoDbBeacon::new("network", 15, 756);
72+
let beacon = fake_data::beacon();
7273
certificate_pending.signed_entity_type =
7374
SignedEntityType::CardanoImmutableFilesFull(beacon.clone());
7475

mithril-common/src/entities/cardano_db_beacon.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ impl CardanoDbBeacon {
6161
}
6262
}
6363

64+
/// Value used as a placeholder where a beacon is necessary
65+
#[deprecated]
66+
pub fn empty() -> Self {
67+
Self::new("", 0, 0)
68+
}
69+
6470
/// Computes the hash of a CardanoDbBeacon
6571
pub fn compute_hash(&self) -> String {
6672
let mut hasher = Sha256::new();

0 commit comments

Comments
 (0)