Skip to content

Commit

Permalink
Add blockheight to getstakeinfo results (decred#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp authored Jul 27, 2016
1 parent a6f2e09 commit 68bff37
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
29 changes: 21 additions & 8 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/rpchelp/helpdescs_en_US.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ var helpDescsEnUS = map[string]string{
"getstakeinfo--synopsis": "Returns statistics about staking from the wallet.",

// GetStakeInfoResult help.
"getstakeinforesult-blockheight": "Current block height for stake info.",
"getstakeinforesult-poolsize": "Number of live tickets in the ticket pool.",
"getstakeinforesult-difficulty": "Current stake difficulty.",
"getstakeinforesult-allmempooltix": "Number of tickets currently in the mempool",
Expand Down
1 change: 1 addition & 0 deletions rpc/legacyrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,7 @@ func getStakeInfo(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClie
}

resp := &dcrjson.GetStakeInfoResult{
BlockHeight: stakeInfo.BlockHeight,
PoolSize: stakeInfo.PoolSize,
Difficulty: dcrutil.Amount(stakeDiff).ToCoin(),
AllMempoolTix: stakeInfo.AllMempoolTix,
Expand Down
2 changes: 2 additions & 0 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2413,6 +2413,7 @@ func (w *Wallet) ImportScript(rs []byte, rescan bool, scanFrom int32) error {
// StakeInfoData is a struct containing the data that would be returned from
// a StakeInfo request to the wallet.
type StakeInfoData struct {
BlockHeight int64
PoolSize uint32
AllMempoolTix uint32
OwnMempoolTix uint32
Expand Down Expand Up @@ -2615,6 +2616,7 @@ func (w *Wallet) StakeInfo() (*StakeInfoData, error) {

// Bring it all together.
resp := &StakeInfoData{
BlockHeight: int64(bs.Height),
PoolSize: poolSize,
AllMempoolTix: uint32(len(allMempoolTickets)),
OwnMempoolTix: uint32(len(localTicketsInMempool)),
Expand Down

0 comments on commit 68bff37

Please sign in to comment.