Skip to content

Commit bad3269

Browse files
author
jagdeep sidhu
committed
close the stack which should gracefully shutdown node
1 parent efe0978 commit bad3269

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

eth/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
415415
return nil
416416
}
417417
if ethashConfig.PowMode == ethash.ModeNEVM {
418-
eth.zmqRep = NewZMQRep(eth, config.NEVMPubEP, NEVMIndex{createBlock, addBlock, deleteBlock})
418+
eth.zmqRep = NewZMQRep(stack, eth, config.NEVMPubEP, NEVMIndex{createBlock, addBlock, deleteBlock})
419419
}
420420
return eth, err
421421
}

eth/zmqpubsub.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ package eth
2020
import (
2121
"context"
2222
"github.com/ethereum/go-ethereum/log"
23+
"github.com/ethereum/go-ethereum/node"
2324
"github.com/go-zeromq/zmq4"
2425
"github.com/ethereum/go-ethereum/core/types"
2526
)
2627

2728
type ZMQRep struct {
29+
stack *node.Node
2830
eth *Ethereum
2931
rep zmq4.Socket
3032
nevmIndexer NEVMIndex
@@ -63,7 +65,7 @@ func (zmq *ZMQRep) Init(nevmEP string) error {
6365
if strTopic == "nevmcomms" {
6466
if string(msg.Frames[1]) == "\ndisconnect" {
6567
log.Info("ZMQ: exiting...")
66-
zmq.eth.Stop()
68+
zmq.stack.Close()
6769
return
6870
}
6971
if string(msg.Frames[1]) == "\fstartnetwork" {
@@ -116,9 +118,10 @@ func (zmq *ZMQRep) Init(nevmEP string) error {
116118
return nil
117119
}
118120

119-
func NewZMQRep(ethIn *Ethereum, NEVMPubEP string, nevmIndexerIn NEVMIndex) *ZMQRep {
121+
func NewZMQRep(stackIn *node.Node, ethIn *Ethereum, NEVMPubEP string, nevmIndexerIn NEVMIndex) *ZMQRep {
120122
ctx := context.Background()
121123
zmq := &ZMQRep{
124+
stack: stackIn,
122125
eth: ethIn,
123126
rep: zmq4.NewRep(ctx),
124127
nevmIndexer: nevmIndexerIn,

les/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) {
310310
return nil
311311
}
312312
if config.Ethash.PowMode == ethash.ModeNEVM {
313-
leth.zmqRep = NewZMQRep(leth, config.NEVMPubEP, LightNEVMIndex{addBlock, deleteBlock})
313+
leth.zmqRep = NewZMQRep(stack, leth, config.NEVMPubEP, LightNEVMIndex{addBlock, deleteBlock})
314314
}
315315
return leth, nil
316316
}

les/zmqpubsub.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ package les
2020
import (
2121
"context"
2222
"github.com/ethereum/go-ethereum/log"
23+
"github.com/ethereum/go-ethereum/node"
2324
"github.com/go-zeromq/zmq4"
2425
"github.com/ethereum/go-ethereum/core/types"
2526
)
2627

2728
type ZMQRep struct {
29+
stack *node.Node
2830
leth *LightEthereum
2931
rep zmq4.Socket
3032
nevmIndexer LightNEVMIndex
@@ -63,7 +65,7 @@ func (zmq *ZMQRep) Init(nevmEP string) error {
6365
if strTopic == "nevmcomms" {
6466
if string(msg.Frames[1]) == "\ndisconnect" {
6567
log.Info("ZMQ: exiting...")
66-
zmq.leth.Stop()
68+
zmq.stack.Close()
6769
return
6870
}
6971
if string(msg.Frames[1]) == "\fstartnetwork" {
@@ -106,9 +108,10 @@ func (zmq *ZMQRep) Init(nevmEP string) error {
106108
return nil
107109
}
108110

109-
func NewZMQRep(lethIn *LightEthereum, NEVMPubEP string, nevmIndexerIn LightNEVMIndex) *ZMQRep {
111+
func NewZMQRep(stackIn *node.Node, lethIn *LightEthereum, NEVMPubEP string, nevmIndexerIn LightNEVMIndex) *ZMQRep {
110112
ctx := context.Background()
111113
zmq := &ZMQRep{
114+
stack: stackIn,
112115
leth: lethIn,
113116
rep: zmq4.NewRep(ctx),
114117
nevmIndexer: nevmIndexerIn,

0 commit comments

Comments
 (0)