fix: remove `Qc.parent_view()` that has a bug (#223)
This commit is contained in:
parent
b884e1ceca
commit
8956a3547b
|
@ -139,14 +139,6 @@ impl Qc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The view of the block this qc is for.
|
|
||||||
pub fn parent_view(&self) -> View {
|
|
||||||
match self {
|
|
||||||
Qc::Standard(StandardQc { view, .. }) => *view,
|
|
||||||
Qc::Aggregated(AggregateQc { view, .. }) => *view,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The id of the block this qc is for.
|
/// The id of the block this qc is for.
|
||||||
/// This will be the parent of the block which will include this qc
|
/// This will be the parent of the block which will include this qc
|
||||||
pub fn block(&self) -> BlockId {
|
pub fn block(&self) -> BlockId {
|
||||||
|
@ -163,3 +155,35 @@ impl Qc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn standard_qc() {
|
||||||
|
let standard_qc = StandardQc {
|
||||||
|
view: 10,
|
||||||
|
id: [0; 32],
|
||||||
|
};
|
||||||
|
let qc = Qc::Standard(standard_qc.clone());
|
||||||
|
assert_eq!(qc.view(), 10);
|
||||||
|
assert_eq!(qc.block(), [0; 32]);
|
||||||
|
assert_eq!(qc.high_qc(), standard_qc);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn aggregated_qc() {
|
||||||
|
let aggregated_qc = AggregateQc {
|
||||||
|
view: 20,
|
||||||
|
high_qc: StandardQc {
|
||||||
|
view: 10,
|
||||||
|
id: [0; 32],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let qc = Qc::Aggregated(aggregated_qc.clone());
|
||||||
|
assert_eq!(qc.view(), 20);
|
||||||
|
assert_eq!(qc.block(), [0; 32]);
|
||||||
|
assert_eq!(qc.high_qc(), aggregated_qc.high_qc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue