Skip to content
Snippets Groups Projects
Unverified Commit 2cacb8b8 authored by Luca Moser's avatar Luca Moser Committed by GitHub
Browse files

Bumps network and db versions (#584)

* bumps network and db versions

* make the network id simply a number

* make the network id just a number
parent a06b697a
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,6 @@ import (
"sync"
"github.com/iotaledger/goshimmer/plugins/autopeering/local"
"github.com/iotaledger/goshimmer/plugins/banner"
"github.com/iotaledger/goshimmer/plugins/config"
"github.com/iotaledger/hive.go/autopeering/discover"
"github.com/iotaledger/hive.go/autopeering/peer"
......@@ -25,17 +24,14 @@ import (
// autopeering constants
const (
ProtocolVersion = 0 // update on protocol changes
NetworkVersion = "v0.2" // update on network changes
ProtocolVersion = 0 // update on protocol changes
NetworkVersion = 2 // update on network changes
)
var (
// ErrParsingMasterNode is returned for an invalid master node.
ErrParsingMasterNode = errors.New("cannot parse master node")
// networkID specifies the autopeering network identifier.
networkID = hash32([]byte(banner.AppVersion + NetworkVersion))
// Conn contains the network connection.
Conn *NetConnMetric
)
......@@ -56,11 +52,6 @@ var (
}{c: make(chan *server.Server, 1)}
)
// NetworkID gets the networkID.
func NetworkID() uint32 {
return networkID
}
// Discovery returns the peer discovery instance.
func Discovery() *discover.Protocol {
peerDiscOnce.Do(createPeerDisc)
......@@ -102,7 +93,7 @@ func createPeerDisc() {
}
log.Debugf("Master peers: %v", masterPeers)
peerDisc = discover.New(local.GetInstance(), ProtocolVersion, networkID,
peerDisc = discover.New(local.GetInstance(), ProtocolVersion, NetworkVersion,
discover.Logger(log),
discover.MasterPeers(masterPeers),
)
......
......@@ -10,7 +10,7 @@ import (
const (
// DBVersion defines the version of the database schema this version of GoShimmer supports.
// Every time there's a breaking change regarding the stored data, this version flag should be adjusted.
DBVersion = 2
DBVersion = 3
)
var (
......
......@@ -59,7 +59,7 @@ func checkAutopeeringConnection() {
defer conn.Close()
// create a new discovery server for the port check
disc := discover.New(local.GetInstance(), autopeering.ProtocolVersion, autopeering.NetworkID(), discover.Logger(log))
disc := discover.New(local.GetInstance(), autopeering.ProtocolVersion, autopeering.NetworkVersion, discover.Logger(log))
srv := server.Serve(local.GetInstance(), conn, log, disc)
defer srv.Close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment