[#549] network/cache: Change Get
signature
Make network cache's `Get` method accept `network.Address` argument instead of string. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
e10981a7d3
commit
33bef46f31
19 changed files with 83 additions and 85 deletions
|
@ -401,7 +401,7 @@ type reputationClientConstructor struct {
|
|||
trustStorage *truststorage.Storage
|
||||
|
||||
basicConstructor interface {
|
||||
Get(string) (client.Client, error)
|
||||
Get(*network.Address) (client.Client, error)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ func (c *reputationClient) SearchObject(ctx context.Context, prm *client.SearchO
|
|||
return ids, err
|
||||
}
|
||||
|
||||
func (c *reputationClientConstructor) Get(addr string) (client.Client, error) {
|
||||
func (c *reputationClientConstructor) Get(addr *network.Address) (client.Client, error) {
|
||||
cl, err := c.basicConstructor.Get(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -494,9 +494,9 @@ func (c *reputationClientConstructor) Get(addr string) (client.Client, error) {
|
|||
nm, err := netmap.GetLatestNetworkMap(c.nmSrc)
|
||||
if err == nil {
|
||||
for i := range nm.Nodes {
|
||||
hostAddr, err := network.HostAddrFromMultiaddr(nm.Nodes[i].Address())
|
||||
netAddr, err := network.AddressFromString(nm.Nodes[i].Address())
|
||||
if err == nil {
|
||||
if hostAddr == addr {
|
||||
if netAddr.Equal(addr) {
|
||||
prm := truststorage.UpdatePrm{}
|
||||
prm.SetPeer(reputation.PeerIDFromBytes(nm.Nodes[i].PublicKey()))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue