Skip to content

Commit

Permalink
Use the given context on F3 broadcast message (#706)
Browse files Browse the repository at this point in the history
Respect the given context when broadcasting messages in F3 instead of
using the internal running context.
  • Loading branch information
masih authored Oct 8, 2024
1 parent 9ec9a0e commit f638813
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion f3.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (m *F3) Broadcast(ctx context.Context, signatureBuilder *gpbft.SignatureBui
}

msg := signatureBuilder.Build(msgSig, vrf)
err := state.runner.BroadcastMessage(msg)
err := state.runner.BroadcastMessage(ctx, msg)
if err != nil {
log.Warnf("failed to broadcast message: %+v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions host.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func (h *gpbftRunner) computeNextInstanceStart(cert *certs.FinalityCertificate)

// Sends a message to all other participants.
// The message's sender must be one that the network interface can sign on behalf of.
func (h *gpbftRunner) BroadcastMessage(msg *gpbft.GMessage) error {
func (h *gpbftRunner) BroadcastMessage(ctx context.Context, msg *gpbft.GMessage) error {
if !h.equivFilter.ProcessBroadcast(msg) {
// equivocation filter does its own logging and this error just gets logged
return nil
Expand Down Expand Up @@ -444,7 +444,7 @@ func (h *gpbftRunner) BroadcastMessage(msg *gpbft.GMessage) error {
return fmt.Errorf("marshalling GMessage for broadcast: %w", err)
}

err = h.topic.Publish(h.runningCtx, bw.Bytes())
err = h.topic.Publish(ctx, bw.Bytes())
if err != nil {
return fmt.Errorf("publishing message: %w", err)
}
Expand Down

0 comments on commit f638813

Please sign in to comment.