Commit c69f6895 authored by Brian Tiger Chow's avatar Brian Tiger Chow

feat(peerstore) add peer to peerstore upon instantiation

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent d77c4bb5
......@@ -114,12 +114,16 @@ func (ps *peerstore) WithKeyPair(sk ic.PrivKey, pk ic.PubKey) (Peer, error) {
return nil, errors.Errorf("Failed to hash public key: %v", err)
}
return &peer{id: pkid, pubKey: pk, privKey: sk}, nil
p := &peer{id: pkid, pubKey: pk, privKey: sk}
ps.Add(p)
return p, nil
}
// WithID constructs a peer with given ID.
func (ps *peerstore) WithID(id ID) Peer {
return &peer{id: id}
p := &peer{id: id}
ps.Add(p)
return p
}
// WithIDString constructs a peer with given ID (string).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment