Skip to content

Commit

Permalink
Update node/broadcaster/broadcaster.go
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
sh-cha and coderabbitai[bot] authored Dec 10, 2024
1 parent fda3699 commit 6739dde
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion node/broadcaster/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,21 @@ func (b *Broadcaster) loadPendingTxs(ctx types.Context, stage types.BasicDB, las
}

res, err := b.rpcClient.QueryTx(ctx, txHash)
if err == nil && res != nil {
if err == nil && res != nil && res.TxResult.Code == 0 {
ctx.Logger().Debug("transaction successfully included",
zap.String("hash", pendingTxs[0].TxHash),
zap.Int64("height", res.Height))
err = DeletePendingTx(b.db, pendingTxs[0])
if err != nil {
return err
}
pendingTxs = pendingTxs[1:]
} else if err == nil && res != nil {
ctx.Logger().Warn("transaction failed",
zap.String("hash", pendingTxs[0].TxHash),
zap.Uint32("code", res.TxResult.Code),
zap.String("log", res.TxResult.Log))
}
}
}
}
Expand Down

0 comments on commit 6739dde

Please sign in to comment.