working towards lightwalletd deb package
This commit is contained in:
12
build.sh
12
build.sh
@@ -8,10 +8,22 @@ if ! [ -x "$(command -v go)" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Welcome to the Hush magic folks..."
|
||||||
|
echo ""
|
||||||
|
echo ".------..------..------..------..------..------..------..------..------..------..------..------."
|
||||||
|
echo "|L.--. ||I.--. ||G.--. ||H.--. ||T.--. ||W.--. ||A.--. ||L.--. ||L.--. ||E.--. ||T.--. ||D.--. |"
|
||||||
|
echo "| :/\: || (\/) || :/\: || :/\: || :/\: || :/\: || (\/) || :/\: || :/\: || (\/) || :/\: || :/\: |"
|
||||||
|
echo "| (__) || :\/: || :\/: || (__) || (__) || :\/: || :\/: || (__) || (__) || :\/: || (__) || (__) |"
|
||||||
|
echo "| '--'L|| '--'I|| '--'G|| '--'H|| '--'T|| '--'W|| '--'A|| '--'L|| '--'L|| '--'E|| '--'T|| '--'D|"
|
||||||
|
echo "+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'"
|
||||||
|
|
||||||
# now to compiling...
|
# now to compiling...
|
||||||
|
echo ""
|
||||||
echo "You have go installed, so starting to compile hush lightwalletd for you..."
|
echo "You have go installed, so starting to compile hush lightwalletd for you..."
|
||||||
cd `pwd`/cmd/server
|
cd `pwd`/cmd/server
|
||||||
go build -o lightwalletd main.go
|
go build -o lightwalletd main.go
|
||||||
mv lightwalletd `pwd`/../../lightwalletd
|
mv lightwalletd `pwd`/../../lightwalletd
|
||||||
|
echo ""
|
||||||
echo "lightwalletd is now compiled for you."
|
echo "lightwalletd is now compiled for you."
|
||||||
echo "for options, run ./lightwalletd --help"
|
echo "for options, run ./lightwalletd --help"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@@ -97,6 +98,14 @@ func main() {
|
|||||||
flag.StringVar(&opts.hush3ConfPath, "conf-file", "", "conf file to pull RPC creds from")
|
flag.StringVar(&opts.hush3ConfPath, "conf-file", "", "conf file to pull RPC creds from")
|
||||||
flag.IntVar(&opts.cacheSize, "cache-size", 40000, "number of blocks to hold in the cache")
|
flag.IntVar(&opts.cacheSize, "cache-size", 40000, "number of blocks to hold in the cache")
|
||||||
|
|
||||||
|
// creating --version so help2man will work
|
||||||
|
if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") {
|
||||||
|
// TODO find a better method than hardcode the version number here
|
||||||
|
fmt.Printf("hush lightwalletd version 0.1.1\n")
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
// TODO determine why help2man is now complaining about --help even after I tried creating one...
|
||||||
|
|
||||||
// TODO prod metrics
|
// TODO prod metrics
|
||||||
// TODO support config from file and env vars
|
// TODO support config from file and env vars
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|||||||
32
cmd/server/main_test.go
Normal file
32
cmd/server/main_test.go
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// Copyright 2021 The Hush developers
|
||||||
|
// Released under the GPLv3
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestFileExists checks whether or not the file exists
|
||||||
|
func TestFileExists(t *testing.T) {
|
||||||
|
if fileExists("nonexistent-file") {
|
||||||
|
t.Fatal("fileExists unexpected success")
|
||||||
|
}
|
||||||
|
// If the path exists but is a directory, should return false
|
||||||
|
if fileExists(".") {
|
||||||
|
t.Fatal("fileExists unexpected success")
|
||||||
|
}
|
||||||
|
// The following file should exist, it's what's being tested
|
||||||
|
if !fileExists("main.go") {
|
||||||
|
t.Fatal("fileExists failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fileExists checks if file exists and is not directory to prevent further errors
|
||||||
|
func fileExists(filename string) bool {
|
||||||
|
info, err := os.Stat(filename)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return !info.IsDir()
|
||||||
|
}
|
||||||
@@ -249,7 +249,7 @@ func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*
|
|||||||
// TODO these are called Error but they aren't at the moment.
|
// TODO these are called Error but they aren't at the moment.
|
||||||
// A success will return code 0 and message txhash.
|
// A success will return code 0 and message txhash.
|
||||||
return &walletrpc.LightdInfo{
|
return &walletrpc.LightdInfo{
|
||||||
Version: "0.1-hushlightd",
|
Version: "0.1.1-hushlightd",
|
||||||
Vendor: "Silentdragonlite LightWalletD",
|
Vendor: "Silentdragonlite LightWalletD",
|
||||||
TaddrSupport: true,
|
TaddrSupport: true,
|
||||||
ChainName: chainName,
|
ChainName: chainName,
|
||||||
|
|||||||
Reference in New Issue
Block a user