mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
ethclient/simulated: unexport NewWithNode
This commit is contained in:
parent
2a12a97a98
commit
45953a9896
1 changed files with 6 additions and 4 deletions
|
|
@ -89,7 +89,7 @@ func New(alloc core.GenesisAlloc, gasLimit uint64) *Backend {
|
||||||
conf := ethconfig.Defaults
|
conf := ethconfig.Defaults
|
||||||
conf.Genesis = &genesis
|
conf.Genesis = &genesis
|
||||||
conf.SyncMode = downloader.FullSync
|
conf.SyncMode = downloader.FullSync
|
||||||
sim, err := NewWithNode(stack, &conf, math.MaxUint64)
|
sim, err := newWithNode(stack, &conf, math.MaxUint64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// This should never happen, if it does, please open an issue
|
// This should never happen, if it does, please open an issue
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
@ -97,10 +97,10 @@ func New(alloc core.GenesisAlloc, gasLimit uint64) *Backend {
|
||||||
return sim
|
return sim
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewWithNode sets up a simulated backend on an existing node
|
// newWithNode sets up a simulated backend on an existing node
|
||||||
// this allows users to do persistent simulations.
|
// this allows users to do persistent simulations.
|
||||||
// The provided node must not be started and will be started by NewWithNode
|
// The provided node must not be started and will be started by newWithNode
|
||||||
func NewWithNode(stack *node.Node, conf *eth.Config, blockPeriod uint64) (*Backend, error) {
|
func newWithNode(stack *node.Node, conf *eth.Config, blockPeriod uint64) (*Backend, error) {
|
||||||
backend, err := eth.New(stack, conf)
|
backend, err := eth.New(stack, conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -136,6 +136,8 @@ func NewWithNode(stack *node.Node, conf *eth.Config, blockPeriod uint64) (*Backe
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close shuts down the simBackend.
|
||||||
|
// The simulated backend can't be used afterwards.
|
||||||
func (n *Backend) Close() error {
|
func (n *Backend) Close() error {
|
||||||
if n.client.Client != nil {
|
if n.client.Client != nil {
|
||||||
n.client.Close()
|
n.client.Close()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue