55 "context"
66 "crypto/sha512"
77 "crypto/tls"
8- "encoding/hex"
98 "fmt"
109 "net/url"
1110 "sync"
@@ -615,12 +614,12 @@ func (b *BackoffHandler) initialDelay(ctx context.Context,
615614 return nil
616615 }
617616
618- locatorHash , err := proofLocator .Hash ()
617+ locatorStr , err := proofLocator .LogString ()
619618 if err != nil {
620619 return err
621620 }
622- log .Debugf ( "Handling initial proof transfer delay (locator_hash=%x) " ,
623- locatorHash [:] )
621+ log .DebugS ( ctx , "Handling initial proof transfer delay" , "locator " ,
622+ locatorStr )
624623
625624 // Query delivery log to ensure a sensible rate of delivery attempts.
626625 timestamps , err := b .transferLog .QueryProofTransferLog (
@@ -632,8 +631,8 @@ func (b *BackoffHandler) initialDelay(ctx context.Context,
632631 }
633632
634633 if len (timestamps ) == 0 {
635- log .Debugf ( "No previous transfer attempts found for proof " +
636- "(locator_hash=%x) " , locatorHash [:] )
634+ log .DebugS ( ctx , "No previous transfer attempts found for proof" ,
635+ "locator " , locatorStr )
637636 return nil
638637 }
639638
@@ -650,9 +649,9 @@ func (b *BackoffHandler) initialDelay(ctx context.Context,
650649 backoffResetWait := b .cfg .BackoffResetWait
651650 if timeSinceLastAttempt < backoffResetWait {
652651 waitDuration := backoffResetWait - timeSinceLastAttempt
653- log .Debugf ( "Waiting %v before attempting to transfer proof "+
654- "(locator_hash=%x) using backoff procedure" ,
655- waitDuration , locatorHash [:] )
652+ log .DebugS ( ctx , "Backoff: waiting before attempting to "+
653+ "transfer proof" , "wait_duration" , waitDuration ,
654+ "locator" , locatorStr )
656655
657656 err := b .wait (ctx , waitDuration )
658657 if err != nil {
@@ -674,13 +673,13 @@ func (b *BackoffHandler) Exec(ctx context.Context, proofLocator Locator,
674673 return fmt .Errorf ("backoff config not specified" )
675674 }
676675
677- locatorHash , err := proofLocator .Hash ()
676+ locatorStr , err := proofLocator .LogString ()
678677 if err != nil {
679- return err
678+ return fmt . Errorf ( "generate locator log string: %w" , err )
680679 }
680+
681681 log .InfoS (ctx , "Starting proof transfer backoff procedure" ,
682- "transfer_type" , transferType , "locator_hash" ,
683- hex .EncodeToString (locatorHash [:]))
682+ "transfer_type" , transferType , "locator" , locatorStr )
684683
685684 // Conditionally perform an initial delay based on the transfer log to
686685 // ensure that we don't spam the courier service with proof transfer
@@ -735,9 +734,9 @@ func (b *BackoffHandler) Exec(ctx context.Context, proofLocator Locator,
735734 subscriberEvent (waitEvent )
736735
737736 log .DebugS (ctx , "Backing off: proof transfer failed" ,
738- "transfer_type" , transferType , "locator_hash " ,
739- hex . EncodeToString ( locatorHash [:]) , "backoff" , backoff ,
740- "attempt" , i , "err" , errExec )
737+ "transfer_type" , transferType , "locator " ,
738+ locatorStr , "backoff" , backoff , "attempt" , i , "err" ,
739+ errExec )
741740
742741 // Wait before reattempting execution.
743742 err := b .wait (ctx , backoff )
0 commit comments