From 2cacb8b85fb8812276983bbfbcafbe0cdf27f1fd Mon Sep 17 00:00:00 2001 From: Luca Moser <moser.luca@gmail.com> Date: Mon, 29 Jun 2020 18:40:48 +0200 Subject: [PATCH] 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 --- plugins/autopeering/autopeering.go | 15 +++------------ plugins/database/versioning.go | 2 +- plugins/portcheck/plugin.go | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/plugins/autopeering/autopeering.go b/plugins/autopeering/autopeering.go index 7b33f422..4b3707cc 100644 --- a/plugins/autopeering/autopeering.go +++ b/plugins/autopeering/autopeering.go @@ -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), ) diff --git a/plugins/database/versioning.go b/plugins/database/versioning.go index 0ee20f7b..0b62a5bf 100644 --- a/plugins/database/versioning.go +++ b/plugins/database/versioning.go @@ -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 ( diff --git a/plugins/portcheck/plugin.go b/plugins/portcheck/plugin.go index ebfe045b..e1c75306 100644 --- a/plugins/portcheck/plugin.go +++ b/plugins/portcheck/plugin.go @@ -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() -- GitLab