erigon-pulse/cmd/lightclient/sentinel/handlers/topics.go
Enrique Jose Avila Asapche f2d95d16cc
Adding light client requesting (#5580)
* separated the encoding

* picking random peer node

* sending ping request

* updated enconding and reading

* requesting ping interval and more verbose vars

* disconnecting from unresponsive peers

* penalizing instead of disconnecting for irresponsiveness

* closing stream for streamCodec

* solved meged issues

* changed back

* separated const values

* requesting ping interval to 1 sec

* added closing of read and write stream && receiving responses!

* fixecd typo

* general sending request function

* added constants of resqresp topics

* fixed uncorrect name

* refactored sending requests

* added todo

* little detail

* moved to main

* no need to sleep

* sending request retries until timeout

* type

* lint
2022-10-03 11:05:59 +02:00

31 lines
1.1 KiB
Go

package handlers
const ProtocolPrefix = "/eth2/beacon_chain/req"
const EncodingProtocol = "/ssz_snappy"
// request and response versions
const Schema1 = "/1"
const Schema2 = "/2"
// Request and Response topics
const MetadataTopic = "/metadata"
const PingTopic = "/ping"
const StatusTopic = "/status"
const GoodbyeTopic = "/goodbye"
const BeaconBlockByRangeTopic = "/beacon_block_by_range"
const BeaconBlockByRootTopic = "/beacon_block_by_root"
// Request and Response protocol ids
var (
PingProtocolV1 = ProtocolPrefix + PingTopic + Schema1 + EncodingProtocol
GoodbyeProtocolV1 = ProtocolPrefix + GoodbyeTopic + Schema1 + EncodingProtocol
MedataProtocolV1 = ProtocolPrefix + MetadataTopic + Schema1 + EncodingProtocol
MedataProtocolV2 = ProtocolPrefix + MetadataTopic + Schema2 + EncodingProtocol
StatusProtocolV1 = ProtocolPrefix + StatusTopic + Schema1 + EncodingProtocol
BeaconBlockByRangeProtocolV1 = ProtocolPrefix + BeaconBlockByRangeTopic + Schema1 + EncodingProtocol
BeaconBlockByRootProtocolV1 = ProtocolPrefix + BeaconBlockByRootTopic + Schema1 + EncodingProtocol
)