From 6f4bb10efdf6f8f31b33461eeab3badfef51e92f Mon Sep 17 00:00:00 2001 From: AnilChinchawale Date: Mon, 12 Nov 2018 16:16:24 +0530 Subject: [PATCH] sort by big.Int --- core/blockchain.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index ec077d4add..e31f933a7e 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1622,7 +1622,7 @@ func (bc *BlockChain) UpdateM1() error { } //TODO: smart contract shouldn't return "0x0000000000000000000000000000000000000000" if candidate.String() != "0x0000000000000000000000000000000000000000" { - ms = append(ms, XDPoS.Masternode{Address: candidate, Stake: v.Uint64()}) + ms = append(ms, XDPoS.Masternode{Address: candidate, Stake: v}) } } if len(ms) == 0 { @@ -1630,7 +1630,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 {