Skip to content

Commit

Permalink
go-kosu: Fix wrong initial validators power calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Chain committed Oct 24, 2019
1 parent 8599c73 commit c60377e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/go-kosu/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## master

- Fix wrong initial validators power calculations
- Add --validator family flags to optionally start as a validator node
- Add GetBlocks RPC endpoint
- Fix wrong RPC remote address in lite mode
Expand Down
2 changes: 1 addition & 1 deletion packages/go-kosu/abci/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func TestGenesisStateCorrectness(t *testing.T) {

require.Len(t, res.Validators, 4)
for _, u := range res.Validators {
assert.True(t, u.Power > 0)
assert.True(t, u.Power >= 2000)
}
})
}
3 changes: 2 additions & 1 deletion packages/go-kosu/abci/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func UnifyValidators(updates abci.ValidatorUpdates, state GenesisValidatorSet) (
}

for i := range newSet {
v := newSet[i]
v := &newSet[i]
s := state[i]

// key verification
Expand All @@ -91,6 +91,7 @@ func UnifyValidators(updates abci.ValidatorUpdates, state GenesisValidatorSet) (
// nolint
return nil, errors.New("The genesis file cannot contain validators with voting power other than '1' when the initial_validator_info is set")
}
update.Power = ScaleBalance(bn)
v.Power = update.Power
v.Balance = types.NewBigInt(bn.Bytes())
v.EthAccount = s.EthereumAddress
Expand Down

0 comments on commit c60377e

Please sign in to comment.