mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
More tweaks for BSC headers (#6662)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
parent
03144279ef
commit
5e205f61c0
@ -813,7 +813,7 @@ func (ss *GrpcServer) SendMessageByMinBlock(_ context.Context, inreq *proto_sent
|
|||||||
msgcode != eth.GetPooledTransactionsMsg {
|
msgcode != eth.GetPooledTransactionsMsg {
|
||||||
return reply, fmt.Errorf("sendMessageByMinBlock not implemented for message Id: %s", inreq.Data.Id)
|
return reply, fmt.Errorf("sendMessageByMinBlock not implemented for message Id: %s", inreq.Data.Id)
|
||||||
}
|
}
|
||||||
if !ss.GetStatus().PassivePeers {
|
if inreq.MaxPeers == 1 {
|
||||||
peerInfo, found := ss.findPeerByMinBlock(inreq.MinBlock)
|
peerInfo, found := ss.findPeerByMinBlock(inreq.MinBlock)
|
||||||
if found {
|
if found {
|
||||||
ss.writePeer("sendMessageByMinBlock", peerInfo, msgcode, inreq.Data.Data, 30*time.Second)
|
ss.writePeer("sendMessageByMinBlock", peerInfo, msgcode, inreq.Data.Data, 30*time.Second)
|
||||||
|
@ -393,15 +393,13 @@ func (cs *MultiClient) blockHeaders66(ctx context.Context, in *proto_sentry.Inbo
|
|||||||
|
|
||||||
func (cs *MultiClient) blockHeaders(ctx context.Context, pkt eth.BlockHeadersPacket, rlpStream *rlp.Stream, peerID *proto_types.H512, sentry direct.SentryClient) error {
|
func (cs *MultiClient) blockHeaders(ctx context.Context, pkt eth.BlockHeadersPacket, rlpStream *rlp.Stream, peerID *proto_types.H512, sentry direct.SentryClient) error {
|
||||||
if len(pkt) == 0 {
|
if len(pkt) == 0 {
|
||||||
if cs.Hd.InitialCycle() {
|
outreq := proto_sentry.PeerUselessRequest{
|
||||||
outreq := proto_sentry.PeerUselessRequest{
|
PeerId: peerID,
|
||||||
PeerId: peerID,
|
|
||||||
}
|
|
||||||
if _, err := sentry.PeerUseless(ctx, &outreq, &grpc.EmptyCallOption{}); err != nil {
|
|
||||||
return fmt.Errorf("sending peer useless request: %v", err)
|
|
||||||
}
|
|
||||||
log.Debug("Requested removal of peer for empty header response", "peerId", fmt.Sprintf("%x", ConvertH512ToPeerID(peerID))[:8])
|
|
||||||
}
|
}
|
||||||
|
if _, err := sentry.PeerUseless(ctx, &outreq, &grpc.EmptyCallOption{}); err != nil {
|
||||||
|
return fmt.Errorf("sending peer useless request: %v", err)
|
||||||
|
}
|
||||||
|
log.Debug("Requested removal of peer for empty header response", "peerId", fmt.Sprintf("%x", ConvertH512ToPeerID(peerID))[:8])
|
||||||
// No point processing empty response
|
// No point processing empty response
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -558,16 +556,14 @@ func (cs *MultiClient) blockBodies66(ctx context.Context, inreq *proto_sentry.In
|
|||||||
return fmt.Errorf("decode BlockBodiesPacket66: %w", err)
|
return fmt.Errorf("decode BlockBodiesPacket66: %w", err)
|
||||||
}
|
}
|
||||||
txs, uncles, withdrawals := request.BlockRawBodiesPacket.Unpack()
|
txs, uncles, withdrawals := request.BlockRawBodiesPacket.Unpack()
|
||||||
if len(txs) == 0 && len(uncles) == 0 {
|
if len(txs) == 0 && len(uncles) == 0 && len(withdrawals) == 0 {
|
||||||
if cs.Hd.InitialCycle() {
|
outreq := proto_sentry.PeerUselessRequest{
|
||||||
outreq := proto_sentry.PeerUselessRequest{
|
PeerId: inreq.PeerId,
|
||||||
PeerId: inreq.PeerId,
|
|
||||||
}
|
|
||||||
if _, err := sentry.PeerUseless(ctx, &outreq, &grpc.EmptyCallOption{}); err != nil {
|
|
||||||
return fmt.Errorf("sending peer useless request: %v", err)
|
|
||||||
}
|
|
||||||
log.Debug("Requested removal of peer for empty body response", "peerId", fmt.Sprintf("%x", ConvertH512ToPeerID(inreq.PeerId)))
|
|
||||||
}
|
}
|
||||||
|
if _, err := sentry.PeerUseless(ctx, &outreq, &grpc.EmptyCallOption{}); err != nil {
|
||||||
|
return fmt.Errorf("sending peer useless request: %v", err)
|
||||||
|
}
|
||||||
|
log.Debug("Requested removal of peer for empty body response", "peerId", fmt.Sprintf("%x", ConvertH512ToPeerID(inreq.PeerId)))
|
||||||
// No point processing empty response
|
// No point processing empty response
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -861,10 +861,6 @@ Loop:
|
|||||||
if headerInserter.BestHeaderChanged() { // We do not break unless there best header changed
|
if headerInserter.BestHeaderChanged() { // We do not break unless there best header changed
|
||||||
noProgressCounter = 0
|
noProgressCounter = 0
|
||||||
wasProgress = true
|
wasProgress = true
|
||||||
if !initialCycle {
|
|
||||||
// if this is not an initial cycle, we need to react quickly when new headers are coming in
|
|
||||||
break
|
|
||||||
}
|
|
||||||
// if this is initial cycle, we want to make sure we insert all known headers (inSync)
|
// if this is initial cycle, we want to make sure we insert all known headers (inSync)
|
||||||
if inSync {
|
if inSync {
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user