@@ -51,40 +51,40 @@ const (
5151)
5252
5353type ChainSync struct {
54- oConn * ouroboros.Connection
5554 logger plugin.Logger
56- network string
57- networkMagic uint32
58- address string
59- socketPath string
60- ntcTcp bool
61- intersectTip bool
62- intersectPoints []ocommon.Point
63- includeCbor bool
64- autoReconnect bool
65- autoReconnectDelay time.Duration
6655 statusUpdateFunc StatusUpdateFunc
67- status * ChainSyncStatus
68- errorChan chan error
56+ blockfetchDoneChan chan struct {}
57+ kupoClient * kugo.Client
58+ oConn * ouroboros.Connection
6959 eventChan chan event.Event
70- cursorCache []ocommon. Point
71- dialAddress string
60+ errorChan chan error
61+ status * ChainSyncStatus
7262 dialFamily string
7363 kupoUrl string
74- kupoClient * kugo.Client
75- delayConfirmations uint
76- delayBuffer [][]event.Event
64+ network string
65+ socketPath string
66+ dialAddress string
67+ address string
68+ intersectPoints []ocommon.Point
7769 pendingBlockPoints []ocommon.Point
78- blockfetchDoneChan chan struct {}
70+ delayBuffer [][]event.Event
71+ cursorCache []ocommon.Point
7972 lastTip ochainsync.Tip
73+ delayConfirmations uint
74+ autoReconnectDelay time.Duration
75+ networkMagic uint32
76+ includeCbor bool
77+ ntcTcp bool
78+ intersectTip bool
79+ autoReconnect bool
8080}
8181
8282type ChainSyncStatus struct {
83+ BlockHash string
84+ TipBlockHash string
8385 SlotNumber uint64
8486 BlockNumber uint64
85- BlockHash string
8687 TipSlotNumber uint64
87- TipBlockHash string
8888 TipReached bool
8989}
9090
@@ -297,15 +297,15 @@ func (c *ChainSync) handleRollBackward(
297297 "chainsync.rollback" ,
298298 time .Now (),
299299 nil ,
300- NewRollbackEvent (point ),
300+ event . NewRollbackEvent (point ),
301301 )
302302 // Remove rolled-back events from buffer
303303 if len (c .delayBuffer ) > 0 {
304304 // We iterate backwards to avoid the issues with deleting from a list while iterating over it
305305 for i := len (c .delayBuffer ) - 1 ; i >= 0 ; i -- {
306306 for _ , evt := range c .delayBuffer [i ] {
307307 // Look for block event
308- if blockEvtCtx , ok := evt .Context .(BlockContext ); ok {
308+ if blockEvtCtx , ok := evt .Context .(event. BlockContext ); ok {
309309 // Delete event batch if slot is after rollback point
310310 if blockEvtCtx .SlotNumber > point .Slot {
311311 c .delayBuffer = slices .Delete (c .delayBuffer , i , i + 1 )
@@ -367,8 +367,8 @@ func (c *ChainSync) handleRollForward(
367367 blockEvt := event .New (
368368 "chainsync.block" ,
369369 time .Now (),
370- NewBlockHeaderContext (block .Header ()),
371- NewBlockEvent (block , c .includeCbor ),
370+ event . NewBlockHeaderContext (block .Header ()),
371+ event . NewBlockEvent (block , c .includeCbor ),
372372 )
373373 tmpEvents = append (tmpEvents , blockEvt )
374374 for t , transaction := range block .Transactions () {
@@ -382,13 +382,13 @@ func (c *ChainSync) handleRollForward(
382382 txEvt := event .New (
383383 "chainsync.transaction" ,
384384 time .Now (),
385- NewTransactionContext (
385+ event . NewTransactionContext (
386386 block ,
387387 transaction ,
388388 uint32 (t ),
389389 c .networkMagic ,
390390 ),
391- NewTransactionEvent (
391+ event . NewTransactionEvent (
392392 block ,
393393 transaction ,
394394 c .includeCbor ,
@@ -416,7 +416,7 @@ func (c *ChainSync) handleRollForward(
416416 if uint (len (c .delayBuffer )) > c .delayConfirmations {
417417 for _ , evt := range c .delayBuffer [0 ] {
418418 // Look for block event
419- if blockEvt , ok := evt .Payload .(BlockEvent ); ok {
419+ if blockEvt , ok := evt .Payload .(event. BlockEvent ); ok {
420420 // Populate current point for update status based on most recently sent events
421421 updateTip = ochainsync.Tip {
422422 Point : ocommon.Point {
@@ -449,8 +449,8 @@ func (c *ChainSync) handleBlockFetchBlock(
449449 blockEvt := event .New (
450450 "chainsync.block" ,
451451 time .Now (),
452- NewBlockContext (block , c .networkMagic ),
453- NewBlockEvent (block , c .includeCbor ),
452+ event . NewBlockContext (block , c .networkMagic ),
453+ event . NewBlockEvent (block , c .includeCbor ),
454454 )
455455 c .eventChan <- blockEvt
456456 for t , transaction := range block .Transactions () {
@@ -464,13 +464,13 @@ func (c *ChainSync) handleBlockFetchBlock(
464464 txEvt := event .New (
465465 "chainsync.transaction" ,
466466 time .Now (),
467- NewTransactionContext (
467+ event . NewTransactionContext (
468468 block ,
469469 transaction ,
470470 uint32 (t ),
471471 c .networkMagic ,
472472 ),
473- NewTransactionEvent (
473+ event . NewTransactionEvent (
474474 block ,
475475 transaction ,
476476 c .includeCbor ,
0 commit comments