Skip to content

Commit

Permalink
fix: find online representatives bug
Browse files Browse the repository at this point in the history
Signed-off-by: wenchao <[email protected]>
  • Loading branch information
wenchaopeng authored and gythialy committed Mar 14, 2019
1 parent f0de4b6 commit 019f4eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions consensus/active_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (act *ActiveTrx) announceVotes() {
act.addWinner2Ledger(block)
} else {
localRepAccount.Range(func(k, v interface{}) bool {
count++
address = k.(types.Address)
act.dps.saveOnlineRep(&address)
va, err := act.dps.voteGenerate(block, address, v.(*types.Account))
Expand Down
3 changes: 2 additions & 1 deletion consensus/dpos_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func (dps *DPoS) saveOnlineRep(addr *types.Address) {
func (dps *DPoS) GetOnlineRepresentatives() []*types.Address {
var repAddresses []*types.Address
dps.onlineReps.Range(func(key, value interface{}) bool {

addr := key.(*types.Address)
repAddresses = append(repAddresses, addr)
return true
Expand All @@ -315,7 +316,7 @@ func (dps *DPoS) findOnlineRepresentatives() error {

func (dps *DPoS) cleanOnlineReps() {
var repAddresses []*types.Address
now := time.Now().Add(repTimeout).UTC().Unix()
now := time.Now().UTC().Unix()
dps.onlineReps.Range(func(key, value interface{}) bool {
addr := key.(*types.Address)
v := value.(int64)
Expand Down

0 comments on commit 019f4eb

Please sign in to comment.