mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
Fixes to sentry (#1698)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
parent
eb64d4738d
commit
a3cf656b68
@ -375,6 +375,7 @@ func grpcSentryServer(ctx context.Context, sentryAddr string) (*SentryServerImpl
|
||||
}
|
||||
grpcServer = grpc.NewServer(opts...)
|
||||
sentryServer := &SentryServerImpl{
|
||||
ctx: ctx,
|
||||
receiveCh: make(chan StreamMsg, 1024),
|
||||
receiveUploadCh: make(chan StreamMsg, 1024),
|
||||
}
|
||||
@ -545,7 +546,7 @@ func (ss *SentryServerImpl) SendMessageById(_ context.Context, inreq *proto_sent
|
||||
peerID := string(gointerfaces.ConvertH512ToBytes(inreq.PeerId))
|
||||
rwRaw, ok := ss.peerRwMap.Load(peerID)
|
||||
if !ok {
|
||||
return &proto_sentry.SentPeers{}, fmt.Errorf("peer not found: %s", inreq.PeerId)
|
||||
return &proto_sentry.SentPeers{}, fmt.Errorf("peer not found: %s", peerID)
|
||||
}
|
||||
rw, _ := rwRaw.(p2p.MsgReadWriter)
|
||||
var msgcode uint64
|
||||
|
@ -117,7 +117,10 @@ func (cs *ControlServerImpl) sendHeaderRequest(ctx context.Context, req *headerd
|
||||
}
|
||||
|
||||
func (cs *ControlServerImpl) randSentryIndex() (int, bool, func() (int, bool)) {
|
||||
i := rand.Intn(len(cs.sentries) - 1)
|
||||
var i int
|
||||
if len(cs.sentries) > 1 {
|
||||
i = rand.Intn(len(cs.sentries) - 1)
|
||||
}
|
||||
to := i
|
||||
return i, true, func() (int, bool) {
|
||||
i = (i + 1) % len(cs.sentries)
|
||||
|
@ -69,7 +69,7 @@ func StageLoop(
|
||||
// but call .Begin() after hearer/body download stages
|
||||
var tx ethdb.DbWithPendingMutations
|
||||
if canRunCycleInOneTransaction {
|
||||
tx, err = tx.Begin(context.Background(), ethdb.RW)
|
||||
tx, err = db.Begin(context.Background(), ethdb.RW)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user