2020-06-14 07:34:50 +00:00
|
|
|
package netmode
|
|
|
|
|
2020-06-14 19:38:43 +00:00
|
|
|
import "strconv"
|
|
|
|
|
2020-06-14 07:34:50 +00:00
|
|
|
const (
|
|
|
|
// MainNet contains magic code used in the NEO main official network.
|
|
|
|
MainNet Magic = 0x004f454e // 5195086
|
|
|
|
// TestNet contains magic code used in the NEO testing network.
|
|
|
|
TestNet Magic = 0x744f454e // 1951352142
|
|
|
|
// PrivNet contains magic code usually used for NEO private networks.
|
|
|
|
PrivNet Magic = 56753 // docker privnet
|
|
|
|
// UnitTestNet is a stub magic code used for testing purposes.
|
2020-06-14 19:40:52 +00:00
|
|
|
UnitTestNet Magic = 42
|
2020-06-14 07:34:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Magic describes the network the blockchain will operate on.
|
|
|
|
type Magic uint32
|
|
|
|
|
|
|
|
// String implements the stringer interface.
|
|
|
|
func (n Magic) String() string {
|
|
|
|
switch n {
|
|
|
|
case PrivNet:
|
|
|
|
return "privnet"
|
|
|
|
case TestNet:
|
|
|
|
return "testnet"
|
|
|
|
case MainNet:
|
|
|
|
return "mainnet"
|
|
|
|
case UnitTestNet:
|
|
|
|
return "unit_testnet"
|
|
|
|
default:
|
2020-06-14 19:38:43 +00:00
|
|
|
return "net 0x" + strconv.FormatUint(uint64(n), 16)
|
2020-06-14 07:34:50 +00:00
|
|
|
}
|
|
|
|
}
|