Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions p2p/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,18 @@ func (s *Subscriber[H]) Broadcast(ctx context.Context, header H, opts ...pubsub.
if err != nil {
return err
}

opts = append(opts, pubsub.WithValidatorData(header))
return s.topic.Publish(ctx, bin, opts...)
}

func (s *Subscriber[H]) verifyMessage(ctx context.Context, p peer.ID, msg *pubsub.Message) (res pubsub.ValidationResult) {
if msg.ValidatorData != nil {
// means the message is local and was already validated
// so simply accept it
return pubsub.ValidationAccept
}

defer func() {
err := recover()
if err != nil {
Expand Down