diff --git a/swarm/network/kademlia.go b/swarm/network/kademlia.go index 212884a30b..5fda51e3eb 100644 --- a/swarm/network/kademlia.go +++ b/swarm/network/kademlia.go @@ -432,7 +432,6 @@ func (k *Kademlia) eachAddr(base []byte, o int, f func(*BzzAddr, int, bool) bool // neighbourhoodDepth returns the proximity order that defines the distance of // the nearest neighbour set with cardinality >= MinProxBinSize // if there is altogether less than MinProxBinSize peers it returns 0 -// caller must hold the lock func (k *Kademlia) NeighbourhoodDepth() (depth int) { k.lock.RLock() defer k.lock.RUnlock() diff --git a/swarm/pss/protocol_test.go b/swarm/pss/protocol_test.go index de74468f2e..520c48a202 100644 --- a/swarm/pss/protocol_test.go +++ b/swarm/pss/protocol_test.go @@ -129,9 +129,8 @@ func testProtocol(t *testing.T) { case <-lmsgC: log.Debug("lnode ok") case cerr := <-lctx.Done(): - _ = cerr + t.Fatalf("test message timed out: %v", cerr) return - //t.Fatalf("test message timed out: %v", cerr) } select { case <-rmsgC: diff --git a/swarm/pss/pss.go b/swarm/pss/pss.go index b2ae48f67d..e80812cd3e 100644 --- a/swarm/pss/pss.go +++ b/swarm/pss/pss.go @@ -510,11 +510,11 @@ func (p *Pss) isSelfPossibleRecipient(msg *PssMsg, prox bool) bool { return false } - minProx := p.Kademlia.NeighbourhoodDepth() - depth, _ := p.Kademlia.Pof(p.Kademlia.BaseAddr(), msg.To, 0) - log.Trace("selfpossible", "minprox", minProx, "depth", depth) + depth := p.Kademlia.NeighbourhoodDepth() + po, _ := p.Kademlia.Pof(p.Kademlia.BaseAddr(), msg.To, 0) + log.Trace("selfpossible", "po", po, "depth", depth) - if minProx <= depth { + if po <= depth { return true } return false @@ -770,6 +770,9 @@ func (p *Pss) SendRaw(address PssAddress, topic Topic, msg []byte) error { if err != nil { return err } + + // if we have a proxhandler on this topic + // also deliver message to ourselves if p.isSelfPossibleRecipient(pssMsg, true) && p.topicHandlerCaps[topic].prox { return p.process(pssMsg, true, true) }