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

Switch from eth/66 to eth/67 #503

Merged
merged 11 commits into from
Jun 28, 2022
56 changes: 18 additions & 38 deletions direct/sentry_client.go
Original file line number Diff line number Diff line change
@@ -19,53 +19,35 @@ 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 (
ETH65 = 65
ETH66 = 66
ETH67 = 67
)

var ProtoIds = map[uint]map[sentry.MessageId]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{}{},
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{}{},
},
}

@@ -119,10 +101,8 @@ func (c *SentryClientRemote) HandShake(ctx context.Context, in *emptypb.Empty, o
c.Lock()
defer c.Unlock()
switch reply.Protocol {
case sentry.Protocol_ETH65:
c.protocol = ETH65
case sentry.Protocol_ETH66:
c.protocol = ETH66
case sentry.Protocol_ETH67:
c.protocol = ETH67
default:
return nil, fmt.Errorf("unexpected protocol: %d", reply.Protocol)
}
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