mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-04 22:03:07 +00:00
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…
x
Reference in New Issue
Block a user