mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
sort by big.Int
This commit is contained in:
parent
fcce1d4fc6
commit
bf11a67367
2 changed files with 3 additions and 3 deletions
|
|
@ -53,7 +53,7 @@ const (
|
|||
|
||||
type Masternode struct {
|
||||
Address common.Address
|
||||
Stake uint64
|
||||
Stake *big.Int
|
||||
}
|
||||
|
||||
// Posv proof-of-stake-voting protocol constants.
|
||||
|
|
|
|||
|
|
@ -1624,7 +1624,7 @@ func (bc *BlockChain) UpdateM1() error {
|
|||
}
|
||||
//TODO: smart contract shouldn't return "0x0000000000000000000000000000000000000000"
|
||||
if candidate.String() != "0x0000000000000000000000000000000000000000" {
|
||||
ms = append(ms, posv.Masternode{Address: candidate, Stake: v.Uint64()})
|
||||
ms = append(ms, posv.Masternode{Address: candidate, Stake: v})
|
||||
}
|
||||
}
|
||||
if len(ms) == 0 {
|
||||
|
|
@ -1632,7 +1632,7 @@ func (bc *BlockChain) UpdateM1() error {
|
|||
os.Exit(1)
|
||||
} else {
|
||||
sort.Slice(ms, func(i, j int) bool {
|
||||
return ms[i].Stake >= ms[j].Stake
|
||||
return ms[i].Stake.Cmp(ms[j].Stake) >= 0
|
||||
})
|
||||
log.Info("Ordered list of masternode candidates")
|
||||
for _, m := range ms {
|
||||
|
|
|
|||
Loading…
Reference in a new issue