Skip to content

Commit e7de8b2

Browse files
committed
chore(common): remove now unused conversion from ChainPoint to pallas types
1 parent 1089484 commit e7de8b2

File tree

1 file changed

+0
-68
lines changed

1 file changed

+0
-68
lines changed

mithril-common/src/entities/cardano_chain_point.rs

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ use serde::{Deserialize, Serialize};
55

66
use crate::entities::{BlockNumber, SlotNumber};
77

8-
cfg_fs! {
9-
use pallas_network::miniprotocols::{chainsync::Tip, Point};
10-
}
11-
128
/// Hash of a Cardano Block
139
pub type BlockHash = String;
1410

@@ -39,20 +35,6 @@ impl ChainPoint {
3935
}
4036
}
4137

42-
/// Create a new origin chain point
43-
pub fn origin() -> ChainPoint {
44-
ChainPoint {
45-
slot_number: SlotNumber(0),
46-
block_number: BlockNumber(0),
47-
block_hash: String::new(),
48-
}
49-
}
50-
51-
/// Check if origin chain point
52-
pub fn is_origin(&self) -> bool {
53-
self.slot_number == 0 && self.block_number == 0 && self.block_hash.is_empty()
54-
}
55-
5638
cfg_test_tools! {
5739
/// Create a dummy ChainPoint
5840
pub fn dummy() -> Self {
@@ -90,56 +72,6 @@ impl Ord for ChainPoint {
9072
}
9173
}
9274

93-
cfg_fs! {
94-
impl From<ChainPoint> for Point {
95-
fn from(chain_point: ChainPoint) -> Self {
96-
match chain_point.is_origin() {
97-
true => Self::Origin,
98-
false => Self::Specific(
99-
*chain_point.slot_number,
100-
hex::decode(&chain_point.block_hash).unwrap(), // TODO: keep block_hash as a Vec<u8>
101-
),
102-
}
103-
}
104-
}
105-
106-
impl From<Point> for ChainPoint {
107-
fn from(point: Point) -> Self {
108-
match point {
109-
Point::Specific(slot_number, block_hash) => Self {
110-
slot_number: SlotNumber(slot_number),
111-
block_number: BlockNumber(0),
112-
block_hash: hex::encode(block_hash),
113-
},
114-
Point::Origin => Self {
115-
slot_number: SlotNumber(0),
116-
block_number: BlockNumber(0),
117-
block_hash: String::new(),
118-
},
119-
}
120-
}
121-
}
122-
123-
impl From<Tip> for ChainPoint {
124-
fn from(tip: Tip) -> Self {
125-
let chain_point: Self = tip.0.into();
126-
Self {
127-
slot_number: chain_point.slot_number,
128-
block_number: BlockNumber(tip.1),
129-
block_hash: chain_point.block_hash,
130-
}
131-
}
132-
}
133-
134-
impl From<ChainPoint> for Tip {
135-
fn from(chain_point: ChainPoint) -> Self {
136-
let block_number = chain_point.block_number;
137-
let point: Point = chain_point.into();
138-
Tip(point, *block_number)
139-
}
140-
}
141-
}
142-
14375
#[cfg(test)]
14476
mod tests {
14577
use std::cmp::Ordering;

0 commit comments

Comments
 (0)