fix broken WithMessageAuthor option
This commit is contained in:
parent
1246e80812
commit
4f45d455f8
|
@ -308,13 +308,14 @@ func WithMessageSigning(enabled bool) Option {
|
|||
// must be available in the host's peerstore.
|
||||
func WithMessageAuthor(author peer.ID) Option {
|
||||
return func(p *PubSub) error {
|
||||
author := author
|
||||
if author == "" {
|
||||
author = p.host.ID()
|
||||
}
|
||||
if p.signKey != nil {
|
||||
newSignKey := p.host.Peerstore().PrivKey(author)
|
||||
if newSignKey == nil {
|
||||
return fmt.Errorf("can't sign for peer %s: no private key", p.signID)
|
||||
return fmt.Errorf("can't sign for peer %s: no private key", author)
|
||||
}
|
||||
p.signKey = newSignKey
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue