Skip to content

Commit

Permalink
Merge pull request #88 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v0.2.3
  • Loading branch information
danil-lashin authored Aug 23, 2018
2 parents ba9c54d + 9ec9442 commit 6de666a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
9 changes: 1 addition & 8 deletions api/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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 @@ -81,13 +80,7 @@ func GetValidators(w http.ResponseWriter, r *http.Request) {

var responseValidators []Validator

count := validators.GetValidatorsCountForBlock(uint64(height))

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

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

Expand Down
4 changes: 2 additions & 2 deletions core/minter/minter.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (app *Blockchain) EndBlock(req abciTypes.RequestEndBlock) abciTypes.Respons
valsCount = len(newCandidates)
}

var newValidators []abciTypes.Validator
newValidators := make([]abciTypes.Validator, valsCount)

// calculate total power
totalPower := big.NewInt(0)
Expand All @@ -208,7 +208,7 @@ func (app *Blockchain) EndBlock(req abciTypes.RequestEndBlock) abciTypes.Respons
power = 1
}

newValidators = append(newValidators, abciTypes.Ed25519Validator(newCandidates[i].PubKey, power))
newValidators[i] = abciTypes.Ed25519Validator(newCandidates[i].PubKey, power)
}

// update validators in state
Expand Down
13 changes: 4 additions & 9 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -773,16 +773,11 @@ func (s *StateDB) GetCandidates(count int, block int64) []Candidate {
count = len(activeCandidates)
}

// 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
})

activeCandidates = activeCandidates[:count]
}
sort.Slice(activeCandidates, func(i, j int) bool {
return activeCandidates[i].TotalBipStake.Cmp(activeCandidates[j].TotalBipStake) == 1
})

return activeCandidates
return activeCandidates[:count]
}

func (s *StateDB) AddAccumReward(pubkey types.Pubkey, reward *big.Int) {
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 = "2"
Fix = "3"
)

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

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

0 comments on commit 6de666a

Please sign in to comment.