mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
consensus: change os.Exit to return error (#1653)
This commit is contained in:
parent
44b7ea8081
commit
845137849d
1 changed files with 3 additions and 4 deletions
|
|
@ -22,7 +22,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -2757,12 +2756,12 @@ func (bc *BlockChain) UpdateM1() error {
|
||||||
// get masternodes information from smart contract
|
// get masternodes information from smart contract
|
||||||
client, err := bc.GetClient()
|
client, err := bc.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to get client: %w", err)
|
||||||
}
|
}
|
||||||
addr := common.MasternodeVotingSMCBinary
|
addr := common.MasternodeVotingSMCBinary
|
||||||
validator, err := contractValidator.NewXDCValidator(addr, client)
|
validator, err := contractValidator.NewXDCValidator(addr, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to create validator contract: %w", err)
|
||||||
}
|
}
|
||||||
opts := new(bind.CallOpts)
|
opts := new(bind.CallOpts)
|
||||||
|
|
||||||
|
|
@ -2794,7 +2793,7 @@ func (bc *BlockChain) UpdateM1() error {
|
||||||
}
|
}
|
||||||
if len(ms) == 0 {
|
if len(ms) == 0 {
|
||||||
log.Error("No masternode found. Stopping node")
|
log.Error("No masternode found. Stopping node")
|
||||||
os.Exit(1)
|
return errors.New("no masternode found")
|
||||||
} else {
|
} else {
|
||||||
sort.Slice(ms, func(i, j int) bool {
|
sort.Slice(ms, func(i, j int) bool {
|
||||||
return ms[i].Stake.Cmp(ms[j].Stake) >= 0
|
return ms[i].Stake.Cmp(ms[j].Stake) >= 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue