aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/pss/protocol.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2019-02-20 16:48:12 +0800
committerGitHub <noreply@github.com>2019-02-20 16:48:12 +0800
commitc942700427557e3ff6de3aaf6b916e2f056c1ec2 (patch)
treecadf68e7206d6de42b1eefc6967214cf86e35ff2 /swarm/pss/protocol.go
parent7fa3509e2eaf1a4ebc12344590e5699406690f15 (diff)
parentcde35439e058b4f9579830fec9fb65ae0b998346 (diff)
downloaddexon-c942700427557e3ff6de3aaf6b916e2f056c1ec2.tar.gz
dexon-c942700427557e3ff6de3aaf6b916e2f056c1ec2.tar.zst
dexon-c942700427557e3ff6de3aaf6b916e2f056c1ec2.zip
Merge pull request #19029 from holiman/update1.8
Update1.8
Diffstat (limited to 'swarm/pss/protocol.go')
-rw-r--r--swarm/pss/protocol.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/swarm/pss/protocol.go b/swarm/pss/protocol.go
index 5fcae090e..7f186f615 100644
--- a/swarm/pss/protocol.go
+++ b/swarm/pss/protocol.go
@@ -241,20 +241,16 @@ func (p *Protocol) AddPeer(peer *p2p.Peer, topic Topic, asymmetric bool, key str
rw.sendFunc = p.Pss.SendSym
}
if asymmetric {
- p.Pss.pubKeyPoolMu.Lock()
- if _, ok := p.Pss.pubKeyPool[key]; !ok {
+ if !p.Pss.isPubKeyStored(key) {
return nil, fmt.Errorf("asym key does not exist: %s", key)
}
- p.Pss.pubKeyPoolMu.Unlock()
p.RWPoolMu.Lock()
p.pubKeyRWPool[key] = rw
p.RWPoolMu.Unlock()
} else {
- p.Pss.symKeyPoolMu.Lock()
- if _, ok := p.Pss.symKeyPool[key]; !ok {
+ if !p.Pss.isSymKeyStored(key) {
return nil, fmt.Errorf("symkey does not exist: %s", key)
}
- p.Pss.symKeyPoolMu.Unlock()
p.RWPoolMu.Lock()
p.symKeyRWPool[key] = rw
p.RWPoolMu.Unlock()