Merge pull request #3539 from nspcc-dev/netmode

netmode: add constant MainNetNeoFS and TestNetNeoFS
This commit is contained in:
Anna Shaleva 2024-08-05 15:30:32 +03:00 committed by GitHub
commit 6651b683a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View file

@ -129,9 +129,9 @@ func getEmbeddedConfig(configPath string) ([]byte, error) {
return config.TestNet, nil
case fmt.Sprintf("%s/protocol.%s.yml", DefaultConfigPath, netmode.PrivNet):
return config.PrivNet, nil
case fmt.Sprintf("%s/protocol.mainnet.neofs.yml", DefaultConfigPath):
case fmt.Sprintf("%s/protocol.%s.yml", DefaultConfigPath, netmode.MainNetNeoFS):
return config.MainNetNeoFS, nil
case fmt.Sprintf("%s/protocol.testnet.neofs.yml", DefaultConfigPath):
case fmt.Sprintf("%s/protocol.%s.yml", DefaultConfigPath, netmode.TestNetNeoFS):
return config.TestNetNeoFS, nil
default:
return nil, fmt.Errorf("config '%s' doesn't exist and no matching embedded config was found", configPath)

View file

@ -11,6 +11,10 @@ const (
PrivNet Magic = 56753 // docker privnet
// UnitTestNet is a stub magic code used for testing purposes.
UnitTestNet Magic = 42
//MainNetNeoFS contains magic code used in the NeoFS main network.
MainNetNeoFS Magic = 0x572dfa5 // NeoFS mainnet
//TestNetNeoFS contains magic code used in the NeoFS test network.
TestNetNeoFS Magic = 0x2bdb2b5f // NeoFS testnet
)
// Magic describes the network the blockchain will operate on.
@ -27,6 +31,10 @@ func (n Magic) String() string {
return "mainnet"
case UnitTestNet:
return "unit_testnet"
case MainNetNeoFS:
return "mainnet.neofs"
case TestNetNeoFS:
return "testnet.neofs"
default:
return "net 0x" + strconv.FormatUint(uint64(n), 16)
}

View file

@ -1197,6 +1197,8 @@ func TestConfig_LoadDefaultConfigs(t *testing.T) {
netmode.PrivNet,
netmode.TestNet,
netmode.UnitTestNet,
netmode.MainNetNeoFS,
netmode.TestNetNeoFS,
"privnet.docker.one",
"privnet.docker.two",
"privnet.docker.three",