@@ -47,6 +47,8 @@ var eraIntersect = map[int]map[string][]interface{}{
4747 "mary" : []interface {}{18014387 , "9914c8da22a833a777d8fc1f735d2dbba70b99f15d765b6c6ee45fe322d92d93" },
4848 // Last block of epoch 153 (Mary era)
4949 "alonzo" : []interface {}{36158304 , "2b95ce628d36c3f8f37a32c2942b48e4f9295ccfe8190bcbc1f012e1e97c79eb" },
50+ // Last block of epoch 214 (Alonzo era)
51+ "babbage" : []interface {}{62510369 , "d931221f9bc4cae34de422d9f4281a2b0344e86aac6b31eb54e2ee90f44a09b9" },
5052 },
5153 MAINNET_MAGIC : map [string ][]interface {}{
5254 "byron" : []interface {}{},
@@ -58,6 +60,7 @@ var eraIntersect = map[int]map[string][]interface{}{
5860 "mary" : []interface {}{23068793 , "69c44ac1dda2ec74646e4223bc804d9126f719b1c245dadc2ad65e8de1b276d7" },
5961 // Last block of epoch 289 (Mary era)
6062 "alonzo" : []interface {}{39916796 , "e72579ff89dc9ed325b723a33624b596c08141c7bd573ecfff56a1f7229e4d09" },
63+ // TODO: add Babbage starting point after mainnet hard fork
6164 },
6265}
6366
@@ -184,10 +187,14 @@ func chainSyncRollForwardHandler(blockType uint, blockData interface{}) error {
184187 syncState .byronEpochSlot = uint64 (h .ConsensusData .SlotId .Slot )
185188 blockSlot = syncState .byronEpochBaseSlot + syncState .byronEpochSlot
186189 blockHash , _ = hex .DecodeString (h .Id ())
187- default :
190+ case block . BLOCK_TYPE_SHELLEY , block . BLOCK_TYPE_ALLEGRA , block . BLOCK_TYPE_MARY , block . BLOCK_TYPE_ALONZO :
188191 h := blockData .(* block.ShelleyBlockHeader )
189192 blockSlot = h .Body .Slot
190193 blockHash , _ = hex .DecodeString (h .Id ())
194+ case block .BLOCK_TYPE_BABBAGE :
195+ h := blockData .(* block.BabbageBlockHeader )
196+ blockSlot = h .Body .Slot
197+ blockHash , _ = hex .DecodeString (h .Id ())
191198 }
192199 if err := syncState .oConn .BlockFetch .RequestRange ([]interface {}{blockSlot , blockHash }, []interface {}{blockSlot , blockHash }); err != nil {
193200 fmt .Printf ("error calling RequestRange: %s\n " , err )
@@ -213,6 +220,9 @@ func chainSyncRollForwardHandler(blockType uint, blockData interface{}) error {
213220 case block .BLOCK_TYPE_ALONZO :
214221 b := blockData .(* block.AlonzoBlock )
215222 fmt .Printf ("era = Alonzo, slot = %d, block_no = %d, id = %s\n " , b .Header .Body .Slot , b .Header .Body .BlockNumber , b .Id ())
223+ case block .BLOCK_TYPE_BABBAGE :
224+ b := blockData .(* block.BabbageBlock )
225+ fmt .Printf ("era = Babbage, slot = %d, block_no = %d, id = %s\n " , b .Header .Body .Slot , b .Header .Body .BlockNumber , b .Id ())
216226 default :
217227 fmt .Printf ("unsupported (so far) block type %d\n " , blockType )
218228 fmt .Printf ("%s\n " , utils .DumpCborStructure (blockData , "" ))
@@ -267,6 +277,9 @@ func blockFetchBlockHandler(blockType uint, blockData interface{}) error {
267277 case block .BLOCK_TYPE_ALONZO :
268278 b := blockData .(* block.AlonzoBlock )
269279 fmt .Printf ("era = Alonzo, slot = %d, block_no = %d, id = %s\n " , b .Header .Body .Slot , b .Header .Body .BlockNumber , b .Id ())
280+ case block .BLOCK_TYPE_BABBAGE :
281+ b := blockData .(* block.BabbageBlock )
282+ fmt .Printf ("era = Babbage, slot = %d, block_no = %d, id = %s\n " , b .Header .Body .Slot , b .Header .Body .BlockNumber , b .Id ())
270283 default :
271284 fmt .Printf ("unsupported (so far) block type %d\n " , blockType )
272285 fmt .Printf ("%s\n " , utils .DumpCborStructure (blockData , "" ))
0 commit comments