From 1d0ef1da6d9e7d5b93d8d1383fb4ea6deb5cee34 Mon Sep 17 00:00:00 2001 From: Brannon King Date: Tue, 14 Dec 2021 19:55:15 -0500 Subject: [PATCH] [lbry] added staked value to balance call --- chain/rpc.go | 2 +- rpc/legacyrpc/methods.go | 4 +--- wallet/wallet.go | 5 +++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/chain/rpc.go b/chain/rpc.go index 4f63959..1c48181 100644 --- a/chain/rpc.go +++ b/chain/rpc.go @@ -89,7 +89,7 @@ func NewRPCClient(chainParams *chaincfg.Params, connect, user, pass string, cert // BackEnd returns the name of the driver. func (c *RPCClient) BackEnd() string { - return "" + return "lbcd" } // Start attempts to establish a client connection with the remote server. diff --git a/rpc/legacyrpc/methods.go b/rpc/legacyrpc/methods.go index 500a921..b19d8b7 100644 --- a/rpc/legacyrpc/methods.go +++ b/rpc/legacyrpc/methods.go @@ -542,7 +542,6 @@ func getAddressInfo(icmd interface{}, w *wallet.Wallet) (interface{}, error) { // type embeddedAddressInfo struct { // # Address string `json:"address"` // # ScriptPubKey string `json:"scriptPubKey"` - // Solvable bool `json:"solvable"` // Descriptor *string `json:"desc,omitempty"` // IsScript bool `json:"isscript"` // IsChange bool `json:"ischange"` @@ -649,8 +648,7 @@ func getInfo(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) ( // to using the manager version. info.WalletVersion = int32(waddrmgr.LatestMgrVersion) info.Balance = bal.ToBTC() - _ = staked // TODO: add this to lbcd: - // info.Staked = staked.ToBTC() + info.Staked = staked.ToBTC() info.PaytxFee = float64(txrules.DefaultRelayFeePerKb) // We don't set the following since they don't make much sense in the // wallet architecture: diff --git a/wallet/wallet.go b/wallet/wallet.go index 4323f36..3970296 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -2655,8 +2655,9 @@ func (w *Wallet) ListUnspent(minconf, maxconf int32, ScriptPubKey: hex.EncodeToString(output.PkScript), Amount: output.Amount.ToBTC(), Confirmations: int64(confs), - Spendable: spendable, // presently false for stakes - // TODO: add an IsStake flag here to lbcd + Spendable: spendable, + // Solvable: , TODO: make this work + IsStake: isStake(output.PkScript), } // BUG: this should be a JSON array so that all