mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 21:54:30 +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"
|
||||
"io"
|
||||
"math/big"
|
||||
"os"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
|
@ -2757,12 +2756,12 @@ func (bc *BlockChain) UpdateM1() error {
|
|||
// get masternodes information from smart contract
|
||||
client, err := bc.GetClient()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to get client: %w", err)
|
||||
}
|
||||
addr := common.MasternodeVotingSMCBinary
|
||||
validator, err := contractValidator.NewXDCValidator(addr, client)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to create validator contract: %w", err)
|
||||
}
|
||||
opts := new(bind.CallOpts)
|
||||
|
||||
|
|
@ -2794,7 +2793,7 @@ func (bc *BlockChain) UpdateM1() error {
|
|||
}
|
||||
if len(ms) == 0 {
|
||||
log.Error("No masternode found. Stopping node")
|
||||
os.Exit(1)
|
||||
return errors.New("no masternode found")
|
||||
} else {
|
||||
sort.Slice(ms, func(i, j int) bool {
|
||||
return ms[i].Stake.Cmp(ms[j].Stake) >= 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue