Skip to content

Commit

Permalink
Merge pull request #5387 from filcloud/build-network
Browse files Browse the repository at this point in the history
add calibnet and mainnet in version
  • Loading branch information
magik6k committed Jan 25, 2021
2 parents d6c0688 + d0a1c52 commit a2b91a5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
7 changes: 6 additions & 1 deletion api/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -157,7 +158,11 @@ func (ts *testSuite) testVersion(t *testing.T) {
if err != nil {
t.Fatal(err)
}
require.Equal(t, v.Version, build.BuildVersion)
versions := strings.Split(v.Version, "+")
if len(versions) <= 0 {
t.Fatal("empty version")
}
require.Equal(t, versions[0], build.BuildVersion)
}

func (ts *testSuite) testSearchMsg(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions build/params_calibnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func init() {
SetAddressNetwork(address.Testnet)

Devnet = true

BuildType = BuildCalibnet
}

const BlockDelaySecs = uint64(builtin2.EpochDurationSeconds)
Expand Down
2 changes: 2 additions & 0 deletions build/params_mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func init() {
}

Devnet = false

BuildType = BuildMainnet
}

const BlockDelaySecs = uint64(builtin2.EpochDurationSeconds)
Expand Down
16 changes: 11 additions & 5 deletions build/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,25 @@ var CurrentCommit string
var BuildType int

const (
BuildDefault = 0
Build2k = 0x1
BuildDebug = 0x3
BuildDefault = 0
BuildMainnet = 0x1
Build2k = 0x2
BuildDebug = 0x3
BuildCalibnet = 0x4
)

func buildType() string {
switch BuildType {
case BuildDefault:
return ""
case BuildDebug:
return "+debug"
case BuildMainnet:
return "+mainnet"
case Build2k:
return "+2k"
case BuildDebug:
return "+debug"
case BuildCalibnet:
return "+calibnet"
default:
return "+huh?"
}
Expand Down

0 comments on commit a2b91a5

Please sign in to comment.