From 9dde8146a732ddfeb893191818ec0b77a956a4f0 Mon Sep 17 00:00:00 2001 From: timorl Date: Tue, 3 Jan 2023 12:20:48 +0100 Subject: [PATCH] Add justification implementation --- finality-aleph/src/sync/substrate/mod.rs | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/finality-aleph/src/sync/substrate/mod.rs b/finality-aleph/src/sync/substrate/mod.rs index e7e46924a4..56cd111be1 100644 --- a/finality-aleph/src/sync/substrate/mod.rs +++ b/finality-aleph/src/sync/substrate/mod.rs @@ -3,7 +3,10 @@ use std::hash::{Hash, Hasher}; use aleph_primitives::BlockNumber; use sp_runtime::traits::{CheckedSub, Header as SubstrateHeader, One}; -use crate::sync::{BlockIdentifier, Header}; +use crate::{ + sync::{BlockIdentifier, Header, Justification as JustificationT}, + AlephJustification, +}; mod status_notifier; @@ -47,3 +50,23 @@ impl> Header for H { }) } } + +/// A justification, including the related header. +#[derive(Clone)] +pub struct Justification> { + header: H, + raw_justification: AlephJustification, +} + +impl> JustificationT for Justification { + type Header = H; + type Unverified = Self; + + fn header(&self) -> &Self::Header { + &self.header + } + + fn into_unverified(self) -> Self::Unverified { + self + } +}