aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/swarm.go
diff options
context:
space:
mode:
authorholisticode <holistic.computing@gmail.com>2017-04-13 17:06:19 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-04-13 17:06:19 +0800
commit409b61fe3c8046dc26f3442846e9f7032bebb9c5 (patch)
tree041d051d192165fdf1d56391ec63c67822492476 /swarm/swarm.go
parentd5d910e8b68f6c6b29ca85f5a9fa1b72b2cc08c1 (diff)
downloaddexon-409b61fe3c8046dc26f3442846e9f7032bebb9c5.tar.gz
dexon-409b61fe3c8046dc26f3442846e9f7032bebb9c5.tar.zst
dexon-409b61fe3c8046dc26f3442846e9f7032bebb9c5.zip
swarm/api: better name resolver handling (#3754)
Fixes #3608
Diffstat (limited to 'swarm/swarm.go')
-rw-r--r--swarm/swarm.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/swarm/swarm.go b/swarm/swarm.go
index eedac93f3..442e68d51 100644
--- a/swarm/swarm.go
+++ b/swarm/swarm.go
@@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/contracts/chequebook"
"github.com/ethereum/go-ethereum/contracts/ens"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
@@ -134,9 +135,13 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api.
// set up high level api
transactOpts := bind.NewKeyedTransactor(self.privateKey)
- self.dns, err = ens.NewENS(transactOpts, config.EnsRoot, self.backend)
- if err != nil {
- return nil, err
+ if backend == (*ethclient.Client)(nil) {
+ log.Warn("No ENS, please specify non-empty --ethapi to use domain name resolution")
+ } else {
+ self.dns, err = ens.NewENS(transactOpts, config.EnsRoot, self.backend)
+ if err != nil {
+ return nil, err
+ }
}
log.Debug(fmt.Sprintf("-> Swarm Domain Name Registrar @ address %v", config.EnsRoot.Hex()))