Skip to content

Commit

Permalink
[lbry] version: update codebase to use version package
Browse files Browse the repository at this point in the history
  • Loading branch information
roylee17 committed May 24, 2022
1 parent 3662f31 commit 7c5a2c6
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 159 deletions.
3 changes: 2 additions & 1 deletion cmd/lbcctl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
flags "github.com/jessevdk/go-flags"
"github.com/lbryio/lbcd/btcjson"
"github.com/lbryio/lbcd/chaincfg"
"github.com/lbryio/lbcd/version"
btcutil "github.com/lbryio/lbcutil"
)

Expand Down Expand Up @@ -214,7 +215,7 @@ func loadConfig() (*config, []string, error) {
appName = strings.TrimSuffix(appName, filepath.Ext(appName))
usageMessage := fmt.Sprintf("Use %s -h to show options", appName)
if preCfg.ShowVersion {
fmt.Println(appName, "version", version())
fmt.Println(appName, "version", version.Full())
os.Exit(0)
}

Expand Down
75 changes: 0 additions & 75 deletions cmd/lbcctl/version.go

This file was deleted.

3 changes: 2 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
_ "github.com/lbryio/lbcd/database/ffldb"
"github.com/lbryio/lbcd/mempool"
"github.com/lbryio/lbcd/peer"
"github.com/lbryio/lbcd/version"
"github.com/lbryio/lbcd/wire"
btcutil "github.com/lbryio/lbcutil"
)
Expand Down Expand Up @@ -469,7 +470,7 @@ func loadConfig() (*config, []string, error) {
appName = strings.TrimSuffix(appName, filepath.Ext(appName))
usageMessage := fmt.Sprintf("Use %s -h to show usage", appName)
if preCfg.ShowVersion {
fmt.Println(appName, "version", version())
fmt.Println(appName, "version", version.Full())
os.Exit(0)
}

Expand Down
3 changes: 2 additions & 1 deletion lbcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/lbryio/lbcd/claimtrie/param"
"github.com/lbryio/lbcd/database"
"github.com/lbryio/lbcd/limits"
"github.com/lbryio/lbcd/version"

"github.com/felixge/fgprof"
)
Expand Down Expand Up @@ -64,7 +65,7 @@ func btcdMain(serverChan chan<- *server) error {
defer btcdLog.Info("Shutdown complete")

// Show version at startup.
btcdLog.Infof("Version %s", version())
btcdLog.Infof("Version %s", version.Full())

// Enable http profiling server if requested.
if cfg.Profile != "" {
Expand Down
5 changes: 3 additions & 2 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"github.com/lbryio/lbcd/mining/cpuminer"
"github.com/lbryio/lbcd/peer"
"github.com/lbryio/lbcd/txscript"
"github.com/lbryio/lbcd/version"
"github.com/lbryio/lbcd/wire"
btcutil "github.com/lbryio/lbcutil"
)
Expand Down Expand Up @@ -2451,7 +2452,7 @@ func handleGetHeaders(s *rpcServer, cmd interface{}, closeChan <-chan struct{})
func handleGetInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
best := s.cfg.Chain.BestSnapshot()
ret := &btcjson.InfoChainResult{
Version: int32(1000000*appMajor + 10000*appMinor + 100*appPatch),
Version: version.Numeric(),
ProtocolVersion: int32(maxProtocolVersion),
Blocks: best.Height,
TimeOffset: int64(s.cfg.TimeSource.Offset().Seconds()),
Expand Down Expand Up @@ -2750,7 +2751,7 @@ func handleGetNetworkInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct

reply := &btcjson.GetNetworkInfoResult{
ProtocolVersion: int32(wire.ProtocolVersion),
Version: versionNumeric(),
Version: version.Numeric(),
Connections: s.cfg.ConnMgr.ConnectedCount(),
IncrementalFee: cfg.MinRelayTxFee,
LocalAddresses: localAddrs,
Expand Down
3 changes: 2 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/lbryio/lbcd/netsync"
"github.com/lbryio/lbcd/peer"
"github.com/lbryio/lbcd/txscript"
"github.com/lbryio/lbcd/version"
"github.com/lbryio/lbcd/wire"
"github.com/lbryio/lbcutil"
btcutil "github.com/lbryio/lbcutil"
Expand Down Expand Up @@ -71,7 +72,7 @@ var (

// userAgentVersion is the user agent version and is used to help
// identify ourselves to other bitcoin peers.
userAgentVersion = fmt.Sprintf("%d.%d.%d", appMajor, appMinor, appPatch)
userAgentVersion = version.Full()
)

// zeroHash is the zero value hash (all zeros). It is defined as a convenience.
Expand Down
4 changes: 3 additions & 1 deletion service_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"path/filepath"
"time"

"github.com/lbryio/lbcd/version"

"github.com/btcsuite/winsvc/eventlog"
"github.com/btcsuite/winsvc/mgr"
"github.com/btcsuite/winsvc/svc"
Expand All @@ -36,7 +38,7 @@ var elog *eventlog.Log
// been started to the Windows event log.
func logServiceStartOfDay(srvr *server) {
var message string
message += fmt.Sprintf("Version %s\n", version())
message += fmt.Sprintf("Version %s\n", version.Full())
message += fmt.Sprintf("Configuration directory: %s\n", defaultHomeDir)
message += fmt.Sprintf("Configuration file: %s\n", cfg.ConfigFile)
message += fmt.Sprintf("Data directory: %s\n", cfg.DataDir)
Expand Down
77 changes: 0 additions & 77 deletions version.go

This file was deleted.

0 comments on commit 7c5a2c6

Please sign in to comment.