@@ -83,7 +83,9 @@ func (c *ChainSync) Start() error {
8383 }
8484 if c .bulkMode && ! c .intersectTip && c .oConn .BlockFetch () != nil {
8585 var err error
86- c .bulkRangeStart , c .bulkRangeEnd , err = c .oConn .ChainSync ().Client .GetAvailableBlockRange (c .intersectPoints )
86+ c .bulkRangeStart , c .bulkRangeEnd , err = c .oConn .ChainSync ().Client .GetAvailableBlockRange (
87+ c .intersectPoints ,
88+ )
8789 if err != nil {
8890 return err
8991 }
@@ -142,7 +144,11 @@ func (c *ChainSync) setupConnection() error {
142144 // If network has well-known public root address/port, use those as our dial default
143145 if network .PublicRootAddress != "" && network .PublicRootPort > 0 {
144146 dialFamily = "tcp"
145- dialAddress = fmt .Sprintf ("%s:%d" , network .PublicRootAddress , network .PublicRootPort )
147+ dialAddress = fmt .Sprintf (
148+ "%s:%d" ,
149+ network .PublicRootAddress ,
150+ network .PublicRootPort ,
151+ )
146152 useNtn = true
147153 }
148154 }
@@ -199,13 +205,25 @@ func (c *ChainSync) setupConnection() error {
199205 return nil
200206}
201207
202- func (c * ChainSync ) handleRollBackward (point ocommon.Point , tip ochainsync.Tip ) error {
203- evt := event .New ("chainsync.rollback" , time .Now (), nil , NewRollbackEvent (point ))
208+ func (c * ChainSync ) handleRollBackward (
209+ point ocommon.Point ,
210+ tip ochainsync.Tip ,
211+ ) error {
212+ evt := event .New (
213+ "chainsync.rollback" ,
214+ time .Now (),
215+ nil ,
216+ NewRollbackEvent (point ),
217+ )
204218 c .eventChan <- evt
205219 return nil
206220}
207221
208- func (c * ChainSync ) handleRollForward (blockType uint , blockData interface {}, tip ochainsync.Tip ) error {
222+ func (c * ChainSync ) handleRollForward (
223+ blockType uint ,
224+ blockData interface {},
225+ tip ochainsync.Tip ,
226+ ) error {
209227 switch v := blockData .(type ) {
210228 case ledger.Block :
211229 evt := event .New ("chainsync.block" , time .Now (), NewBlockContext (v ), NewBlockEvent (v , c .includeCbor ))
@@ -230,13 +248,29 @@ func (c *ChainSync) handleRollForward(blockType uint, blockData interface{}, tip
230248}
231249
232250func (c * ChainSync ) handleBlockFetchBlock (block ledger.Block ) error {
233- blockEvt := event .New ("chainsync.block" , time .Now (), NewBlockContext (block ), NewBlockEvent (block , c .includeCbor ))
251+ blockEvt := event .New (
252+ "chainsync.block" ,
253+ time .Now (),
254+ NewBlockContext (block ),
255+ NewBlockEvent (block , c .includeCbor ),
256+ )
234257 c .eventChan <- blockEvt
235258 for t , transaction := range block .Transactions () {
236- txEvt := event .New ("chainsync.transaction" , time .Now (), NewTransactionContext (block , transaction , uint32 (t )), NewTransactionEvent (block , transaction , c .includeCbor ))
259+ txEvt := event .New (
260+ "chainsync.transaction" ,
261+ time .Now (),
262+ NewTransactionContext (block , transaction , uint32 (t )),
263+ NewTransactionEvent (block , transaction , c .includeCbor ),
264+ )
237265 c .eventChan <- txEvt
238266 }
239- c .updateStatus (block .SlotNumber (), block .BlockNumber (), block .Hash (), c .bulkRangeEnd .Slot , hex .EncodeToString (c .bulkRangeEnd .Hash ))
267+ c .updateStatus (
268+ block .SlotNumber (),
269+ block .BlockNumber (),
270+ block .Hash (),
271+ c .bulkRangeEnd .Slot ,
272+ hex .EncodeToString (c .bulkRangeEnd .Hash ),
273+ )
240274 // Start normal chain-sync if we've reached the last block of our bulk range
241275 if block .SlotNumber () == c .bulkRangeEnd .Slot {
242276 if err := c .oConn .ChainSync ().Client .Sync ([]ocommon.Point {c .bulkRangeEnd }); err != nil {
@@ -246,7 +280,13 @@ func (c *ChainSync) handleBlockFetchBlock(block ledger.Block) error {
246280 return nil
247281}
248282
249- func (c * ChainSync ) updateStatus (slotNumber uint64 , blockNumber uint64 , blockHash string , tipSlotNumber uint64 , tipBlockHash string ) {
283+ func (c * ChainSync ) updateStatus (
284+ slotNumber uint64 ,
285+ blockNumber uint64 ,
286+ blockHash string ,
287+ tipSlotNumber uint64 ,
288+ tipBlockHash string ,
289+ ) {
250290 // Determine if we've reached the chain tip
251291 if ! c .status .TipReached {
252292 // Make sure we're past the end slot in any bulk range, since we don't update the tip during bulk sync
0 commit comments