Closed robvanmieghem closed 5 years ago
I created a small patch to re-add the initial nodes when syncing does not start:
diff --git a/pkg/eth/erc20/client.go b/pkg/eth/erc20/client.go
index d464b06..d7f71c3 100644
--- a/pkg/eth/erc20/client.go
+++ b/pkg/eth/erc20/client.go
@@ -42,7 +42,7 @@ type LightClient struct {
lesc *les.LightEthereum
datadir string
-
+ config LightClientConfig
// optional account info
accountLock sync.RWMutex
account *clientAccountInfo
@@ -88,10 +88,12 @@ func (lccfg *LightClientConfig) validate() error {
}
func addPeers(ethNode *node.Node, peers []*discv5.Node) {
+
for _, peer := range peers {
- old, err := enode.ParseV4(peer.String())
+ newPeer, err := enode.ParseV4(peer.String())
if err != nil {
- ethNode.Server().AddPeer(old)
+ log.Debug("Adding peer", "peer", newPeer)
+ ethNode.Server().AddPeer(newPeer)
}
}
}
@@ -177,6 +179,7 @@ func NewLightClient(lccfg LightClientConfig) (*LightClient, error) {
stack: stack,
lesc: lesc,
datadir: datadir,
+ config: lccfg,
}, nil
}
@@ -329,6 +332,7 @@ func (lc *LightClient) Wait(ctx context.Context) error {
log.Info(
"LightClient needs to start to sync",
"current_block", progress.CurrentBlock, "peers", lc.stack.Server().Peers())
+ addPeers(lc.stack, lc.config.BootstrapNodes)
} else if downloader.Synchronising() || progress.CurrentBlock < progress.HighestBlock {
log.Debug(
"LightClient is still syncing, waiting 10 seconds...",
Let's see after deploying to our terstnet if this is needed
Fixed in 239f9e755eb31b9e4b04a332e0d36a2cb40e9c07
The following issue can help in solving this one: Setting the ethereum loglevel is missing in tfchaind