Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated mx-chain-communication-go with NetworkType #5435

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/seednode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ func createNode(
P2pPrivateKey: p2pKey,
P2pSingleSigner: p2pSingleSigner,
P2pKeyGenerator: p2pKeyGen,
NetworkType: p2p.MainNetwork,
Logger: logger.GetOrCreate("seed/p2p"),
}

Expand Down
6 changes: 4 additions & 2 deletions factory/network/networkComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func (ncf *networkComponentsFactory) createNetworkHolder(
p2pConfig p2pConfig.P2PConfig,
logger p2p.Logger,
peersRatingHandler p2p.PeersRatingHandler,
networkType p2p.NetworkType,
) (networkComponentsHolder, error) {

peersHolder, err := p2pFactory.NewPeersHolder(ncf.preferredPeersSlices)
Expand All @@ -254,6 +255,7 @@ func (ncf *networkComponentsFactory) createNetworkHolder(
P2pPrivateKey: ncf.cryptoComponents.P2pPrivateKey(),
P2pSingleSigner: ncf.cryptoComponents.P2pSingleSigner(),
P2pKeyGenerator: ncf.cryptoComponents.P2pKeyGen(),
NetworkType: networkType,
Logger: logger,
}
networkMessenger, err := p2pFactory.NewNetworkMessenger(argsMessenger)
Expand All @@ -269,7 +271,7 @@ func (ncf *networkComponentsFactory) createNetworkHolder(

func (ncf *networkComponentsFactory) createMainNetworkHolder(peersRatingHandler p2p.PeersRatingHandler) (networkComponentsHolder, error) {
loggerInstance := logger.GetOrCreate("main/p2p")
return ncf.createNetworkHolder(ncf.mainP2PConfig, loggerInstance, peersRatingHandler)
return ncf.createNetworkHolder(ncf.mainP2PConfig, loggerInstance, peersRatingHandler, p2p.MainNetwork)
}

func (ncf *networkComponentsFactory) createFullArchiveNetworkHolder(peersRatingHandler p2p.PeersRatingHandler) (networkComponentsHolder, error) {
Expand All @@ -282,7 +284,7 @@ func (ncf *networkComponentsFactory) createFullArchiveNetworkHolder(peersRatingH

loggerInstance := logger.GetOrCreate("full-archive/p2p")

return ncf.createNetworkHolder(ncf.fullArchiveP2PConfig, loggerInstance, peersRatingHandler)
return ncf.createNetworkHolder(ncf.fullArchiveP2PConfig, loggerInstance, peersRatingHandler, p2p.FullArchiveNetwork)
}

func (ncf *networkComponentsFactory) createPeersRatingComponents() (p2p.PeersRatingHandler, p2p.PeersRatingMonitor, error) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/google/gops v0.3.18
github.com/gorilla/websocket v1.5.0
github.com/mitchellh/mapstructure v1.5.0
github.com/multiversx/mx-chain-communication-go v1.0.4-0.20230711151847-0a3789df9544
github.com/multiversx/mx-chain-communication-go v1.0.4-0.20230713134740-1099861bb66e
github.com/multiversx/mx-chain-core-go v1.2.8
github.com/multiversx/mx-chain-crypto-go v1.2.7
github.com/multiversx/mx-chain-es-indexer-go v1.4.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS
github.com/multiversx/concurrent-map v0.1.4 h1:hdnbM8VE4b0KYJaGY5yJS2aNIW9TFFsUYwbO0993uPI=
github.com/multiversx/concurrent-map v0.1.4/go.mod h1:8cWFRJDOrWHOTNSqgYCUvwT7c7eFQ4U2vKMOp4A/9+o=
github.com/multiversx/mx-chain-communication-go v1.0.3/go.mod h1:7oTI77XfWmRWwVEbCq+pjH5CO3mJ6vEiHGMvQv6vF3Y=
github.com/multiversx/mx-chain-communication-go v1.0.4-0.20230711151847-0a3789df9544 h1:E5dIUhpD4BZrxNtMiJnEoTN0RQn8XUa/e2Ago/XQ9O8=
github.com/multiversx/mx-chain-communication-go v1.0.4-0.20230711151847-0a3789df9544/go.mod h1:7oTI77XfWmRWwVEbCq+pjH5CO3mJ6vEiHGMvQv6vF3Y=
github.com/multiversx/mx-chain-communication-go v1.0.4-0.20230713134740-1099861bb66e h1:mmp7vNzX0U6ehJrOfZp3dICdCCv6nLBImKjQy1Gnq4s=
github.com/multiversx/mx-chain-communication-go v1.0.4-0.20230713134740-1099861bb66e/go.mod h1:7oTI77XfWmRWwVEbCq+pjH5CO3mJ6vEiHGMvQv6vF3Y=
github.com/multiversx/mx-chain-core-go v1.1.30/go.mod h1:8gGEQv6BWuuJwhd25qqhCOZbBSv9mk+hLeKvinSaSMk=
github.com/multiversx/mx-chain-core-go v1.2.1/go.mod h1:8gGEQv6BWuuJwhd25qqhCOZbBSv9mk+hLeKvinSaSMk=
github.com/multiversx/mx-chain-core-go v1.2.5/go.mod h1:jzYFSiYBuO0dGpGFXnZWSwcwcKP7Flyn/X41y4zIQrQ=
Expand Down
9 changes: 9 additions & 0 deletions p2p/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ const NormalOperation = p2p.NormalOperation
// FullArchiveMode defines the node operation as a full archive mode
const FullArchiveMode = p2p.FullArchiveMode

// NetworkType defines the type of the network a messenger is running on
type NetworkType = p2p.NetworkType

// MainNetwork defines the main network
const MainNetwork NetworkType = "main"

// FullArchiveNetwork defines the full archive network
const FullArchiveNetwork NetworkType = "full archive"

// ListsSharder is the variant that uses lists
const ListsSharder = p2p.ListsSharder

Expand Down