Skip to content

Commit

Permalink
Merge pull request #87 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v0.2.2
  • Loading branch information
danil-lashin authored Aug 23, 2018
2 parents 3b7c49e + 3e114f0 commit ba9c54d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@

- [api] Add validators rewards to block api

## 0.2.2
*Aug 23th, 2018*

In this update we well test blockchain's hardfork.
There is no need to wipe old data, just be sure to update binary
until 15000 block.

BUG FIXES

- [validators] Fix api

## 0.2.1
*Aug 23th, 2018*

Expand Down
9 changes: 8 additions & 1 deletion api/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/MinterTeam/minter-go-node/core/types"
"net/http"
"strconv"
"github.com/MinterTeam/minter-go-node/core/validators"
)

type Stake struct {
Expand Down Expand Up @@ -80,7 +81,13 @@ func GetValidators(w http.ResponseWriter, r *http.Request) {

var responseValidators []Validator

for _, val := range vals {
count := validators.GetValidatorsCountForBlock(uint64(height))

if len(vals) < count {
count = len(vals)
}

for _, val := range vals[:count] {
responseValidators = append(responseValidators, makeResponseValidator(val, rState))
}

Expand Down
2 changes: 1 addition & 1 deletion core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ func (s *StateDB) GetCandidates(count int, block int64) []Candidate {
// TODO: remove condition in next testnet
if block >= 15000 {
sort.Slice(activeCandidates, func(i, j int) bool {
return activeCandidates[i].TotalBipStake.Cmp(activeCandidates[j].TotalBipStake) == -1
return activeCandidates[i].TotalBipStake.Cmp(activeCandidates[j].TotalBipStake) == 1
})

activeCandidates = activeCandidates[:count]
Expand Down
4 changes: 2 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ package version
const (
Maj = "0"
Min = "2"
Fix = "1"
Fix = "2"
)

var (
// Must be a string because scripts like dist.sh read this file.
Version = "0.2.1"
Version = "0.2.2"

// GitCommit is the current HEAD set using ldflags.
GitCommit string
Expand Down

0 comments on commit ba9c54d

Please sign in to comment.