Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cl/cltypes/lightclient_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package cltypes_test

import (
"testing"

_ "embed"
"testing"

libcommon "github.com/ledgerwatch/erigon-lib/common"

Expand Down
9 changes: 5 additions & 4 deletions cmd/devnet/devnetutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"crypto/rand"
"encoding/json"
"fmt"
"math/big"
"os/exec"
"strconv"
"strings"

libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon/cmd/devnet/models"
"github.com/ledgerwatch/erigon/cmd/rpctest/rpctest"
"github.com/ledgerwatch/erigon/common/hexutil"
"github.com/ledgerwatch/erigon/crypto"
"math/big"
"os/exec"
"strconv"
"strings"
)

// ClearDevDB cleans up the dev folder used for the operations
Expand Down
29 changes: 23 additions & 6 deletions cmd/lightclient/lightclient/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"errors"
"fmt"
"sync"
"time"

"github.com/ledgerwatch/erigon-lib/gointerfaces/grpcutil"
"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
"github.com/ledgerwatch/erigon/cl/clparams"
"github.com/ledgerwatch/erigon/cl/cltypes"
Expand Down Expand Up @@ -46,20 +48,35 @@ func (c *ChainTipSubscriber) StartLoop() {
}
log.Info("[LightClient Gossip] Started Gossip")
c.started = true

Retry:
for {
if err := c.subscribeGossip(); err != nil {
if errors.Is(err, context.Canceled) {
return
}
if grpcutil.IsRetryLater(err) || grpcutil.IsEndOfStream(err) {
time.Sleep(3 * time.Second)
continue Retry
}

log.Warn("[Lightclient] could not read gossip :/", "reason", err)
time.Sleep(time.Second)
}
}
}

func (c *ChainTipSubscriber) subscribeGossip() error {
stream, err := c.sentinel.SubscribeGossip(c.ctx, &sentinel.EmptyMessage{})
if err != nil {
log.Warn("could not start lightclient", "reason", err)
return
return err
}
defer stream.CloseSend()

for {
data, err := stream.Recv()
if err != nil {
if !errors.Is(err, context.Canceled) {
log.Debug("[Lightclient] could not read gossip :/", "reason", err)
}
continue
return err
}
if err := c.handleGossipData(data); err != nil {
log.Warn("could not process new gossip",
Expand Down
2 changes: 0 additions & 2 deletions cmd/release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"sort"
"strings"
"time"

"github.com/hashicorp/go-version"
)

type Binary struct {
Expand Down