diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-12-24 00:31:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-24 00:31:32 +0800 |
commit | 9e9fc87e70accf2b81be8772ab2ab0c914e95666 (patch) | |
tree | 410ccdefb083b08796a14ac03653a5319e9895d7 /swarm/api/api.go | |
parent | 335760bf0674ee553f3ca65afd6f29b6557d1b55 (diff) | |
download | go-tangerine-9e9fc87e70accf2b81be8772ab2ab0c914e95666.tar.gz go-tangerine-9e9fc87e70accf2b81be8772ab2ab0c914e95666.tar.zst go-tangerine-9e9fc87e70accf2b81be8772ab2ab0c914e95666.zip |
swarm: remove unused/dead code (#18351)
Diffstat (limited to 'swarm/api/api.go')
-rw-r--r-- | swarm/api/api.go | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/swarm/api/api.go b/swarm/api/api.go index 33a8e3539..c6ca1b577 100644 --- a/swarm/api/api.go +++ b/swarm/api/api.go @@ -51,10 +51,6 @@ import ( ) var ( - ErrNotFound = errors.New("not found") -) - -var ( apiResolveCount = metrics.NewRegisteredCounter("api.resolve.count", nil) apiResolveFail = metrics.NewRegisteredCounter("api.resolve.fail", nil) apiPutCount = metrics.NewRegisteredCounter("api.put.count", nil) @@ -136,13 +132,6 @@ func MultiResolverOptionWithResolver(r ResolveValidator, tld string) MultiResolv } } -// MultiResolverOptionWithNameHash is unused at the time of this writing -func MultiResolverOptionWithNameHash(nameHash func(string) common.Hash) MultiResolverOption { - return func(m *MultiResolver) { - m.nameHash = nameHash - } -} - // NewMultiResolver creates a new instance of MultiResolver. func NewMultiResolver(opts ...MultiResolverOption) (m *MultiResolver) { m = &MultiResolver{ @@ -173,40 +162,6 @@ func (m *MultiResolver) Resolve(addr string) (h common.Hash, err error) { return } -// ValidateOwner checks the ENS to validate that the owner of the given domain is the given eth address -func (m *MultiResolver) ValidateOwner(name string, address common.Address) (bool, error) { - rs, err := m.getResolveValidator(name) - if err != nil { - return false, err - } - var addr common.Address - for _, r := range rs { - addr, err = r.Owner(m.nameHash(name)) - // we hide the error if it is not for the last resolver we check - if err == nil { - return addr == address, nil - } - } - return false, err -} - -// HeaderByNumber uses the validator of the given domainname and retrieves the header for the given block number -func (m *MultiResolver) HeaderByNumber(ctx context.Context, name string, blockNr *big.Int) (*types.Header, error) { - rs, err := m.getResolveValidator(name) - if err != nil { - return nil, err - } - for _, r := range rs { - var header *types.Header - header, err = r.HeaderByNumber(ctx, blockNr) - // we hide the error if it is not for the last resolver we check - if err == nil { - return header, nil - } - } - return nil, err -} - // getResolveValidator uses the hostname to retrieve the resolver associated with the top level domain func (m *MultiResolver) getResolveValidator(name string) ([]ResolveValidator, error) { rs := m.resolvers[""] @@ -224,11 +179,6 @@ func (m *MultiResolver) getResolveValidator(name string) ([]ResolveValidator, er return rs, nil } -// SetNameHash sets the hasher function that hashes the domain into a name hash that ENS uses -func (m *MultiResolver) SetNameHash(nameHash func(string) common.Hash) { - m.nameHash = nameHash -} - /* API implements webserver/file system related content storage and retrieval on top of the FileStore @@ -265,9 +215,6 @@ func (a *API) Store(ctx context.Context, data io.Reader, size int64, toEncrypt b return a.fileStore.Store(ctx, data, size, toEncrypt) } -// ErrResolve is returned when an URI cannot be resolved from ENS. -type ErrResolve error - // Resolve a name into a content-addressed hash // where address could be an ENS name, or a content addressed hash func (a *API) Resolve(ctx context.Context, address string) (storage.Address, error) { @@ -980,11 +927,6 @@ func (a *API) FeedsUpdate(ctx context.Context, request *feed.Request) (storage.A return a.feed.Update(ctx, request) } -// FeedsHashSize returned the size of the digest produced by Swarm feeds' hashing function -func (a *API) FeedsHashSize() int { - return a.feed.HashSize -} - // ErrCannotLoadFeedManifest is returned when looking up a feeds manifest fails var ErrCannotLoadFeedManifest = errors.New("Cannot load feed manifest") |