33use serde:: Deserialize ;
44
55use mithril_common:: entities:: {
6- BlockNumber , CardanoDbBeacon , Epoch , SignedEntityType , SignedEntityTypeDiscriminants ,
6+ BlockNumber , BlockNumberOffset , CardanoDbBeacon , Epoch , SignedEntityType ,
7+ SignedEntityTypeDiscriminants ,
78} ;
89
910use crate :: sqlite:: HydrationError ;
@@ -90,6 +91,7 @@ impl Hydrator {
9091 struct CardanoBlocksTransactionsBeacon {
9192 epoch : Epoch ,
9293 block_number : BlockNumber ,
94+ block_number_offset : BlockNumberOffset ,
9395 }
9496
9597 let beacon: CardanoBlocksTransactionsBeacon = serde_json:: from_str ( beacon_str)
@@ -98,7 +100,11 @@ impl Hydrator {
98100 "Invalid Beacon JSON in open_message.beacon: '{beacon_str}'. Error: {e}"
99101 ) )
100102 } ) ?;
101- SignedEntityType :: CardanoBlocksTransactions ( beacon. epoch , beacon. block_number )
103+ SignedEntityType :: CardanoBlocksTransactions (
104+ beacon. epoch ,
105+ beacon. block_number ,
106+ beacon. block_number_offset ,
107+ )
102108 }
103109 SignedEntityTypeDiscriminants :: CardanoDatabase => {
104110 let beacon: CardanoDbBeacon = serde_json:: from_str ( beacon_str) . map_err ( |e| {
@@ -132,7 +138,11 @@ mod tests {
132138
133139 #[ test]
134140 fn hydrate_cardano_blocks_transactions_signed_entity_type ( ) {
135- let expected = SignedEntityType :: CardanoBlocksTransactions ( Epoch ( 37 ) , BlockNumber ( 79 ) ) ;
141+ let expected = SignedEntityType :: CardanoBlocksTransactions (
142+ Epoch ( 37 ) ,
143+ BlockNumber ( 79 ) ,
144+ BlockNumberOffset ( 5 ) ,
145+ ) ;
136146 let signed_entity = Hydrator :: hydrate_signed_entity_type (
137147 SignedEntityTypeDiscriminants :: CardanoBlocksTransactions . index ( ) ,
138148 & expected. get_json_beacon ( ) . unwrap ( ) ,
0 commit comments