diff --git a/noble/broadcast.go b/noble/broadcast.go index 0f216cc..d96eafb 100644 --- a/noble/broadcast.go +++ b/noble/broadcast.go @@ -61,12 +61,13 @@ func (n *Noble) Broadcast( // sign and broadcast txn for attempt := 0; attempt <= n.maxRetries; attempt++ { - if err := n.attemptBroadcast(ctx, logger, msgs, sequenceMap, sdkContext, txBuilder); err == nil { + err := n.attemptBroadcast(ctx, logger, msgs, sequenceMap, sdkContext, txBuilder) + if err == nil { return nil } // Log retry information - logger.Info(fmt.Sprintf("Retrying in %d seconds", n.retryIntervalSeconds)) + logger.Error("Broadcasting to noble failed. Retrying...", "error", err, "interval_seconds", n.retryIntervalSeconds) time.Sleep(time.Duration(n.retryIntervalSeconds) * time.Second) } @@ -120,6 +121,10 @@ func (n *Noble) attemptBroadcast( msg.SourceTxHash)) } + if len(receiveMsgs) == 0 { + return nil + } + if err := txBuilder.SetMsgs(receiveMsgs...); err != nil { return fmt.Errorf("failed to set messages on tx: %w", err) } diff --git a/noble/listener.go b/noble/listener.go index 58ff869..6da6af7 100644 --- a/noble/listener.go +++ b/noble/listener.go @@ -94,7 +94,7 @@ func (n *Noble) StartListener( default: block := <-blockQueue res, err := n.cc.RPCClient.TxSearch(ctx, fmt.Sprintf("tx.height=%d", block), false, nil, nil, "") - if err != nil { + if err != nil || res == nil { logger.Debug(fmt.Sprintf("unable to query Noble block %d", block), "error:", err) blockQueue <- block }