diff --git a/core/commands/name/ipns.go b/core/commands/name/ipns.go index 8df592a037a5..9ee2e8c5cff1 100644 --- a/core/commands/name/ipns.go +++ b/core/commands/name/ipns.go @@ -159,16 +159,17 @@ Resolve the value of a dnslink: } return cmds.EmitOnce(res, &ResolvedPath{output}) - } else { - output := resolver.ResolveAsync(req.Context, name, ropts...) - for v := range output { - if v.Err != nil { - return err - } - if err := res.Emit(&ResolvedPath{v.Path}); err != nil { - return err - } + } + + output := resolver.ResolveAsync(req.Context, name, ropts...) + for v := range output { + if v.Err != nil { + return err } + if err := res.Emit(&ResolvedPath{v.Path}); err != nil { + return err + } + } return nil }, diff --git a/namesys/routing.go b/namesys/routing.go index c591d5662ea9..775dab12dfd3 100644 --- a/namesys/routing.go +++ b/namesys/routing.go @@ -89,7 +89,7 @@ func (r *IpnsResolver) resolveOnceAsync(ctx context.Context, name string, option // the value, which in turn verifies the ipns record signature ipnsKey := ipns.RecordKey(pid) - vals, err := r.searchValue(ctx, ipnsKey, dht.Quorum(int(options.DhtRecordCount))) + vals, err := r.routing.SearchValue(ctx, ipnsKey, dht.Quorum(int(options.DhtRecordCount))) if err != nil { log.Debugf("RoutingResolver: dht get for name %s failed: %s", name, err) out <- onceResult{err: err} @@ -173,14 +173,3 @@ func (r *IpnsResolver) resolveOnceAsync(ctx context.Context, name string, option return out } - -func (r *IpnsResolver) searchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error) { - if ir, ok := r.routing.(*dht.IpfsDHT); ok { - return ir.SearchValue(ctx, key, opts...) - } - out := make(chan []byte, 1) - val, err := r.routing.GetValue(ctx, key, opts...) - out <- val - close(out) - return out, err -}