Merge pull request #231 from libp2p/feat/validator-data

add ValidatorData field to Message
This commit is contained in:
vyzo 2019-11-15 20:37:20 +02:00 committed by GitHub
commit 28a87b3121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -155,6 +155,7 @@ type PubSubRouter interface {
type Message struct {
*pb.Message
ReceivedFrom peer.ID
VaidatorData interface{}
}
func (m *Message) GetFrom() peer.ID {
@ -705,7 +706,7 @@ func (p *PubSub) handleIncomingRPC(rpc *RPC) {
continue
}
msg := &Message{pmsg, rpc.from}
msg := &Message{pmsg, rpc.from, nil}
p.pushMsg(msg)
}

View File

@ -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()
}