Browse Source

Try to fix GetCoinsupply

deb-pkg-changes
Duke Leto 1 year ago
parent
commit
56cf2fed1c
  1. 8
      common/common.go
  2. 30
      frontend/service.go

8
common/common.go

@ -12,7 +12,6 @@ import (
"git.hush.is/hush/lightwalletd/parser"
"git.hush.is/hush/lightwalletd/walletrpc"
"github.com/btcsuite/btcd/rpcclient"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@ -157,7 +156,9 @@ type (
}
)
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, int, int, int, error) {
//TODO: this function is not currently used, but some of it's code
// needs to be implemented elsewhere
func GetSaplingInfo() (int, int, string, string, int, int, int, error) {
result, rpcErr := RawRequest("getblockchaininfo", []json.RawMessage{})
var err error
@ -241,6 +242,7 @@ func GetLightdInfo() (*walletrpc.LightdInfo, error) {
//HushdBuild: getinfoReply.Build,
//HushSubversion: getinfoReply.Subversion,
// TODO: get notarized key
// TODO: longestchain
Notarized: uint64(0),
}, nil
}
@ -285,7 +287,7 @@ func GetBlockChainInfo() (*HushdRpcReplyGetblockchaininfo, error) {
return &getblockchaininfoReply, nil
}
func GetCoinsupply(rpcClient *rpcclient.Client) (string, string, int, int, int, int, error) {
func GetCoinsupply() (string, string, int, int, int, int, error) {
result1, rpcErr := RawRequest("coinsupply", []json.RawMessage{})
var err error

30
frontend/service.go

@ -234,38 +234,10 @@ func (s *lwdStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*
return common.GetLightdInfo()
}
// GetLightdInfo gets the LightWalletD (this server) info
/* This is the old GetLightdInfo (our fork of it) , the new GetLightdInfo is in common/common.go
func (s *lwdStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*walletrpc.LightdInfo, error) {
saplingHeight, blockHeight, chainName, consensusBranchId, difficulty, longestchain, notarized, err := common.GetSaplingInfo(s.client)
if err != nil {
s.log.WithFields(logrus.Fields{
"error": err,
}).Warn("Unable to get sapling activation height")
return nil, err
}
// TODO these are called Error but they aren't at the moment.
// A success will return code 0 and message txhash.
return &walletrpc.LightdInfo{
Version: "0.1.2-hushlightd",
Vendor: "Hush lightwalletd",
TaddrSupport: true,
ChainName: chainName,
SaplingActivationHeight: uint64(saplingHeight),
ConsensusBranchId: consensusBranchId,
BlockHeight: uint64(blockHeight),
Difficulty: uint64(difficulty),
Longestchain: uint64(longestchain),
Notarized: uint64(notarized),
}, nil
}
*/
// GetCoinsupply gets the Coinsupply info
func (s *lwdStreamer) GetCoinsupply(ctx context.Context, in *walletrpc.Empty) (*walletrpc.Coinsupply, error) {
result, coin, height, supply, zfunds, total, err := common.GetCoinsupply(s.client)
result, coin, height, supply, zfunds, total, err := common.GetCoinsupply()
if err != nil {
s.log.WithFields(logrus.Fields{

Loading…
Cancel
Save