mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 02:10:46 +00:00
Merge pull request #1708 from gzliudan/fix-v2-sort
eth/hooks: use slices.SortStableFunc in engine_v2
This commit is contained in:
commit
2652df3366
1 changed files with 3 additions and 3 deletions
|
|
@ -3,10 +3,10 @@ package hooks
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/XinFinOrg/XDPoSChain/common"
|
"github.com/XinFinOrg/XDPoSChain/common"
|
||||||
"github.com/XinFinOrg/XDPoSChain/common/sort"
|
|
||||||
"github.com/XinFinOrg/XDPoSChain/consensus"
|
"github.com/XinFinOrg/XDPoSChain/consensus"
|
||||||
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS"
|
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS"
|
||||||
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/utils"
|
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/utils"
|
||||||
|
|
@ -428,8 +428,8 @@ func GetSigningTxCount(c *XDPoS.XDPoS, chain consensus.ChainReader, header *type
|
||||||
ms = append(ms, utils.Masternode{Address: candidate, Stake: v})
|
ms = append(ms, utils.Masternode{Address: candidate, Stake: v})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.Slice(ms, func(i, j int) bool {
|
slices.SortStableFunc(ms, func(a, b utils.Masternode) int {
|
||||||
return ms[i].Stake.Cmp(ms[j].Stake) >= 0
|
return b.Stake.Cmp(a.Stake)
|
||||||
})
|
})
|
||||||
// find penalty and filter them out
|
// find penalty and filter them out
|
||||||
penalties := common.ExtractAddressFromBytes(h.Penalties)
|
penalties := common.ExtractAddressFromBytes(h.Penalties)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue