@@ -225,22 +225,35 @@ func (c *ChainSync) setupConnection() error {
225
225
if c .autoReconnect {
226
226
c .autoReconnectDelay = 0
227
227
if c .logger != nil {
228
- c .logger .Infof ("reconnecting to %s due to error: %s" , c .dialAddress , err )
228
+ c .logger .Infof (
229
+ "reconnecting to %s due to error: %s" ,
230
+ c .dialAddress ,
231
+ err ,
232
+ )
229
233
}
230
234
for {
231
235
if c .autoReconnectDelay > 0 {
232
- c .logger .Infof ("waiting %s to reconnect" , c .autoReconnectDelay )
236
+ c .logger .Infof (
237
+ "waiting %s to reconnect" ,
238
+ c .autoReconnectDelay ,
239
+ )
233
240
time .Sleep (c .autoReconnectDelay )
234
241
// Double current reconnect delay up to maximum
235
- c .autoReconnectDelay = min (c .autoReconnectDelay * 2 , maxAutoReconnectDelay )
242
+ c .autoReconnectDelay = min (
243
+ c .autoReconnectDelay * 2 ,
244
+ maxAutoReconnectDelay ,
245
+ )
236
246
} else {
237
247
// Set initial reconnect delay
238
248
c .autoReconnectDelay = 1 * time .Second
239
249
}
240
250
// Shutdown current connection
241
251
if err := c .oConn .Close (); err != nil {
242
252
if c .logger != nil {
243
- c .logger .Warnf ("failed to properly close connection: %s" , err )
253
+ c .logger .Warnf (
254
+ "failed to properly close connection: %s" ,
255
+ err ,
256
+ )
244
257
}
245
258
}
246
259
// Set the intersect points from the cursor cache
@@ -250,7 +263,11 @@ func (c *ChainSync) setupConnection() error {
250
263
// Restart the connection
251
264
if err := c .Start (); err != nil {
252
265
if c .logger != nil {
253
- c .logger .Infof ("reconnecting to %s due to error: %s" , c .dialAddress , err )
266
+ c .logger .Infof (
267
+ "reconnecting to %s due to error: %s" ,
268
+ c .dialAddress ,
269
+ err ,
270
+ )
254
271
}
255
272
continue
256
273
}
@@ -309,7 +326,11 @@ func (c *ChainSync) handleRollForward(
309
326
return nil
310
327
}
311
328
312
- func (c * ChainSync ) handleBlockFetchBlock (ctx blockfetch.CallbackContext , blockType uint , block ledger.Block ) error {
329
+ func (c * ChainSync ) handleBlockFetchBlock (
330
+ ctx blockfetch.CallbackContext ,
331
+ blockType uint ,
332
+ block ledger.Block ,
333
+ ) error {
313
334
blockEvt := event .New (
314
335
"chainsync.block" ,
315
336
time .Now (),
@@ -356,7 +377,10 @@ func (c *ChainSync) updateStatus(
356
377
) {
357
378
// Update cursor cache
358
379
blockHashBytes , _ := hex .DecodeString (blockHash )
359
- c .cursorCache = append (c .cursorCache , ocommon.Point {Slot : slotNumber , Hash : blockHashBytes })
380
+ c .cursorCache = append (
381
+ c .cursorCache ,
382
+ ocommon.Point {Slot : slotNumber , Hash : blockHashBytes },
383
+ )
360
384
if len (c .cursorCache ) > cursorCacheSize {
361
385
c .cursorCache = c .cursorCache [len (c .cursorCache )- cursorCacheSize :]
362
386
}
0 commit comments