From cf0b87ac9bf4558e38982860e45773758a35a25f Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Fri, 20 Sep 2019 14:49:47 -0700 Subject: [PATCH] Log sapling height --- cmd/server/main.go | 11 +++++++++++ frontend/service.go | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index bae5634..edeb965 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -15,6 +15,7 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/reflection" + "github.com/adityapk00/lightwalletd/common" "github.com/adityapk00/lightwalletd/frontend" "github.com/adityapk00/lightwalletd/walletrpc" ) @@ -159,6 +160,16 @@ func main() { } } + // Get the sapling activation height from the RPC + saplingHeight, chainName, err := common.GetSaplingInfo(rpcClient) + if err != nil { + log.WithFields(logrus.Fields{ + "error": err, + }).Warn("Unable to get sapling activation height") + } + + log.WithField("saplingHeight", saplingHeight).Info("Got sapling height ", saplingHeight, " chain ", chainName) + // Compact transaction service initialization service, err := frontend.NewSQLiteStreamer(opts.dbPath, rpcClient, log) if err != nil { diff --git a/frontend/service.go b/frontend/service.go index 587a3e9..e855127 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -245,7 +245,10 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilte // GetLightdInfo gets the LightWalletD (this server) info func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*walletrpc.LightdInfo, error) { - saplingHeight, chainName, _ := common.GetSaplingInfo(s.client) + saplingHeight, chainName, err := common.GetSaplingInfo(s.client) + if err != nil { + return nil, err + } // TODO these are called Error but they aren't at the moment. // A success will return code 0 and message txhash.