From 8b423348a041b489574b3d4e48fa7f9a94ec9abd Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 15 Nov 2019 20:16:58 +0200 Subject: [PATCH] add ValidatorData field to Message Useful for passing data from the validation to the application. --- pubsub.go | 3 ++- topic.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pubsub.go b/pubsub.go index a769a68..9ed0bc4 100644 --- a/pubsub.go +++ b/pubsub.go @@ -151,6 +151,7 @@ type PubSubRouter interface { type Message struct { *pb.Message ReceivedFrom peer.ID + VaidatorData interface{} } func (m *Message) GetFrom() peer.ID { @@ -688,7 +689,7 @@ func (p *PubSub) handleIncomingRPC(rpc *RPC) { continue } - msg := &Message{pmsg, rpc.from} + msg := &Message{pmsg, rpc.from, nil} p.pushMsg(msg) } diff --git a/topic.go b/topic.go index 5434791..1b57c86 100644 --- a/topic.go +++ b/topic.go @@ -167,7 +167,7 @@ func (t *Topic) Publish(ctx context.Context, data []byte, opts ...PubOpt) error } select { - case t.p.publish <- &Message{m, id}: + case t.p.publish <- &Message{m, id, nil}: case <-t.p.ctx.Done(): return t.p.ctx.Err() }