diff --git a/Cargo.lock b/Cargo.lock index 19182541..b530daba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1707,9 +1707,9 @@ dependencies = [ [[package]] name = "pallas-traverse" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e8818ff5279ef4dbce4d3e83187cbbb85c810eeceb9308081757a3cc4fe1a0" +checksum = "0f84c669596744b97384bfbaed7e222ff76f4ba2fe8939abc3a9335a8080b00b" dependencies = [ "hex", "pallas-codec", diff --git a/src/sources/n2n/headers.rs b/src/sources/n2n/headers.rs index af2fd8a2..28239218 100644 --- a/src/sources/n2n/headers.rs +++ b/src/sources/n2n/headers.rs @@ -1,6 +1,6 @@ use pallas::{ codec::minicbor::decode, - ledger::primitives::{alonzo, byron, ToHash}, + ledger::primitives::{alonzo, babbage, byron, ToHash}, network::miniprotocols::{chainsync::HeaderContent, Point}, }; @@ -11,6 +11,7 @@ pub enum MultiEraHeader { ByronBoundary(byron::EbbHead), Byron(byron::BlockHead), AlonzoCompatible(alonzo::Header), + Babbage(babbage::Header), } impl TryFrom for MultiEraHeader { @@ -28,10 +29,17 @@ impl TryFrom for MultiEraHeader { Ok(MultiEraHeader::Byron(header)) } }, - _ => { + 1 | 2 | 3 | 4 => { let header = decode(&value.cbor)?; Ok(MultiEraHeader::AlonzoCompatible(header)) } + 5 => { + let header = decode(&value.cbor)?; + Ok(MultiEraHeader::Babbage(header)) + } + x => { + return Err(format!("This version of Oura can't handle era: {}", x).into()); + } } } } @@ -53,6 +61,10 @@ impl MultiEraHeader { let hash = x.to_hash(); Ok(Point::Specific(x.header_body.slot, hash.to_vec())) } + MultiEraHeader::Babbage(x) => { + let hash = x.to_hash(); + Ok(Point::Specific(x.header_body.slot, hash.to_vec())) + } } } }