cmd/status, geth/params: move version into separate file (starts 0.9.5)

This commit is contained in:
Victor Farazdagi 2017-03-16 10:39:28 +03:00
parent d2ae1bdda6
commit 4159f97e74
3 changed files with 20 additions and 15 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"fmt"
"github.com/status-im/status-go/geth"
"github.com/status-im/status-go/geth/params"
)
var (
@ -11,17 +12,10 @@ var (
)
func main() {
verString := fmt.Sprintf("%d.%d.%d", geth.VersionMajor, geth.VersionMinor, geth.VersionPatch)
if geth.VersionMeta != "" {
verString += "-" + geth.VersionMeta
}
if gitCommit != "" {
verString += "-" + gitCommit[:8]
}
netVersion := "mainnet"
if geth.UseTestnet {
netVersion = "testnet"
}
fmt.Printf("Status\nGit Commit: %s\nBuild Time: %s\nVersion: %s\nNetwork: %s\n",
gitCommit, buildStamp, verString, netVersion)
fmt.Printf("%s\nVersion: %s\nGit Commit: %s\nBuild Date: %s\nNetwork: %s\n",
geth.ClientIdentifier, params.Version, gitCommit, buildStamp, netVersion)
}

View File

@ -31,10 +31,6 @@ import (
const (
ClientIdentifier = "StatusIM" // Client identifier to advertise over the network
VersionMajor = 0 // Major version component of the current release
VersionMinor = 9 // Minor version component of the current release
VersionPatch = 4 // Patch version component of the current release
VersionMeta = "stable" // Version metadata to append to the version string
IPCFile = "geth.ipc" // Filename of exposed IPC-RPC Server
HTTPPort = 8545 // HTTP-RPC port (replaced in unit tests)
WSPort = 8546 // WS-RPC port (replaced in unit tests)
@ -126,7 +122,7 @@ func MakeNode(config *NodeConfig) *Node {
DataDir: dataDir,
UseLightweightKDF: true,
Name: ClientIdentifier,
Version: fmt.Sprintf("%d.%d.%d-%s", VersionMajor, VersionMinor, VersionPatch, VersionMeta),
Version: params.Version,
NoDiscovery: true,
DiscoveryV5: false,
DiscoveryV5Addr: ":0",
@ -302,7 +298,7 @@ func makeDefaultExtra() []byte {
Name string
GoVersion string
Os string
}{uint(VersionMajor<<16 | VersionMinor<<8 | VersionPatch), ClientIdentifier, runtime.Version(), runtime.GOOS}
}{uint(params.VersionMajor<<16 | params.VersionMinor<<8 | params.VersionPatch), ClientIdentifier, runtime.Version(), runtime.GOOS}
extra, err := rlp.EncodeToBytes(clientInfo)
if err != nil {
glog.V(logger.Warn).Infoln("error setting canonical miner information:", err)

15
geth/params/version.go Normal file
View File

@ -0,0 +1,15 @@
package params
import (
"fmt"
)
const (
VersionMajor = 0 // Major version component of the current release
VersionMinor = 9 // Minor version component of the current release
VersionPatch = 5 // Patch version component of the current release
VersionMeta = "unstable" // Version metadata to append to the version string
)
// Version exposes string representation of program version.
var Version = fmt.Sprintf("%d.%d.%d-%s", VersionMajor, VersionMinor, VersionPatch, VersionMeta)