mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
use errors.Join
This commit is contained in:
parent
31a3ae4ccd
commit
f160500994
1 changed files with 5 additions and 6 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
package simulated
|
package simulated
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum"
|
"github.com/ethereum/go-ethereum"
|
||||||
|
|
@ -142,18 +143,16 @@ func (n *Backend) Close() error {
|
||||||
n.client.Close()
|
n.client.Close()
|
||||||
n.client = simClient{}
|
n.client = simClient{}
|
||||||
}
|
}
|
||||||
var rerr error // return only last error if there are multiple
|
var err error
|
||||||
if n.beacon != nil {
|
if n.beacon != nil {
|
||||||
rerr = n.beacon.Stop()
|
err = n.beacon.Stop()
|
||||||
n.beacon = nil
|
n.beacon = nil
|
||||||
}
|
}
|
||||||
if n.node != nil {
|
if n.node != nil {
|
||||||
if err := n.node.Close(); err != nil {
|
err = errors.Join(err, n.node.Close())
|
||||||
rerr = err
|
|
||||||
}
|
|
||||||
n.node = nil
|
n.node = nil
|
||||||
}
|
}
|
||||||
return rerr
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit seals a block and moves the chain forward to a new empty block.
|
// Commit seals a block and moves the chain forward to a new empty block.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue