Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

Commit

Permalink
Revert "Switch from eth/66 to eth/67 (#503)"
Browse files Browse the repository at this point in the history
This reverts commit eac8c1f.
  • Loading branch information
yperbasis committed Jun 28, 2022
1 parent eac8c1f commit 84dc454
Show file tree
Hide file tree
Showing 16 changed files with 449 additions and 247 deletions.
56 changes: 38 additions & 18 deletions direct/sentry_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,53 @@ package direct
import (
"context"
"fmt"
"google.golang.org/protobuf/proto"
"io"
"sync"

"google.golang.org/protobuf/proto"

"github.com/ledgerwatch/erigon-lib/gointerfaces/sentry"
"github.com/ledgerwatch/erigon-lib/gointerfaces/types"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)

const (
ETH67 = 67
ETH65 = 65
ETH66 = 66
)

var ProtoIds = map[uint]map[sentry.MessageId]struct{}{
ETH67: {
sentry.MessageId_GET_BLOCK_HEADERS: struct{}{},
sentry.MessageId_BLOCK_HEADERS: struct{}{},
sentry.MessageId_GET_BLOCK_BODIES: struct{}{},
sentry.MessageId_BLOCK_BODIES: struct{}{},
sentry.MessageId_GET_RECEIPTS: struct{}{},
sentry.MessageId_RECEIPTS: struct{}{},
sentry.MessageId_NEW_BLOCK_HASHES: struct{}{},
sentry.MessageId_NEW_BLOCK: struct{}{},
sentry.MessageId_TRANSACTIONS: struct{}{},
sentry.MessageId_NEW_POOLED_TRANSACTION_HASHES: struct{}{},
sentry.MessageId_GET_POOLED_TRANSACTIONS: struct{}{},
sentry.MessageId_POOLED_TRANSACTIONS: struct{}{},
ETH65: {
sentry.MessageId_GET_BLOCK_HEADERS_65: struct{}{},
sentry.MessageId_BLOCK_HEADERS_65: struct{}{},
sentry.MessageId_GET_BLOCK_BODIES_65: struct{}{},
sentry.MessageId_BLOCK_BODIES_65: struct{}{},
sentry.MessageId_GET_NODE_DATA_65: struct{}{},
sentry.MessageId_NODE_DATA_65: struct{}{},
sentry.MessageId_GET_RECEIPTS_65: struct{}{},
sentry.MessageId_RECEIPTS_65: struct{}{},
sentry.MessageId_NEW_BLOCK_HASHES_65: struct{}{},
sentry.MessageId_NEW_BLOCK_65: struct{}{},
sentry.MessageId_TRANSACTIONS_65: struct{}{},
sentry.MessageId_NEW_POOLED_TRANSACTION_HASHES_65: struct{}{},
sentry.MessageId_GET_POOLED_TRANSACTIONS_65: struct{}{},
sentry.MessageId_POOLED_TRANSACTIONS_65: struct{}{},
},
ETH66: {
sentry.MessageId_GET_BLOCK_HEADERS_66: struct{}{},
sentry.MessageId_BLOCK_HEADERS_66: struct{}{},
sentry.MessageId_GET_BLOCK_BODIES_66: struct{}{},
sentry.MessageId_BLOCK_BODIES_66: struct{}{},
sentry.MessageId_GET_NODE_DATA_66: struct{}{},
sentry.MessageId_NODE_DATA_66: struct{}{},
sentry.MessageId_GET_RECEIPTS_66: struct{}{},
sentry.MessageId_RECEIPTS_66: struct{}{},
sentry.MessageId_NEW_BLOCK_HASHES_66: struct{}{},
sentry.MessageId_NEW_BLOCK_66: struct{}{},
sentry.MessageId_TRANSACTIONS_66: struct{}{},
sentry.MessageId_NEW_POOLED_TRANSACTION_HASHES_66: struct{}{},
sentry.MessageId_GET_POOLED_TRANSACTIONS_66: struct{}{},
sentry.MessageId_POOLED_TRANSACTIONS_66: struct{}{},
},
}

Expand Down Expand Up @@ -101,8 +119,10 @@ func (c *SentryClientRemote) HandShake(ctx context.Context, in *emptypb.Empty, o
c.Lock()
defer c.Unlock()
switch reply.Protocol {
case sentry.Protocol_ETH67:
c.protocol = ETH67
case sentry.Protocol_ETH65:
c.protocol = ETH65
case sentry.Protocol_ETH66:
c.protocol = ETH66
default:
return nil, fmt.Errorf("unexpected protocol: %d", reply.Protocol)
}
Expand Down
4 changes: 2 additions & 2 deletions gointerfaces/remote/ethbackend.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gointerfaces/remote/ethbackend_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 84dc454

Please sign in to comment.