@@ -106,15 +106,12 @@ func newTestNode(
106106 ds datastore.Batching ,
107107 stopDAHeightTicker func (),
108108) (* FullNode , func ()) {
109- ctx , cancel := context .WithCancel (context .Background ())
110-
111109 // Generate genesis and keys
112110 genesis , genesisValidatorKey , _ := types .GetGenesisWithPrivkey ("test-chain" )
113111 remoteSigner , err := remote_signer .NewNoopSigner (genesisValidatorKey )
114112 require .NoError (t , err )
115113
116114 node , err := NewNode (
117- ctx ,
118115 config ,
119116 executor ,
120117 sequencer ,
@@ -130,7 +127,6 @@ func newTestNode(
130127 require .NoError (t , err )
131128
132129 cleanup := func () {
133- cancel ()
134130 if stopDAHeightTicker != nil {
135131 stopDAHeightTicker ()
136132 }
@@ -164,8 +160,6 @@ func createNodesWithCleanup(t *testing.T, num int, config evconfig.Config) ([]*F
164160
165161 nodes := make ([]* FullNode , num )
166162 cleanups := make ([]func (), num )
167- // Create a cancellable context instead of using background context
168- aggCtx , aggCancel := context .WithCancel (context .Background ())
169163
170164 // Generate genesis and keys
171165 genesis , genesisValidatorKey , _ := types .GetGenesisWithPrivkey ("test-chain" )
@@ -179,7 +173,6 @@ func createNodesWithCleanup(t *testing.T, num int, config evconfig.Config) ([]*F
179173 require .NoError (err )
180174
181175 aggNode , err := NewNode (
182- aggCtx ,
183176 config ,
184177 executor ,
185178 sequencer ,
@@ -196,8 +189,6 @@ func createNodesWithCleanup(t *testing.T, num int, config evconfig.Config) ([]*F
196189
197190 // Update cleanup to cancel the context instead of calling Stop
198191 cleanup := func () {
199- // Cancel the context to stop the node
200- aggCancel ()
201192 stopDAHeightTicker ()
202193 }
203194
@@ -209,15 +200,13 @@ func createNodesWithCleanup(t *testing.T, num int, config evconfig.Config) ([]*F
209200 peersList = append (peersList , aggPeerAddress )
210201 }
211202 for i := 1 ; i < num ; i ++ {
212- ctx , cancel := context .WithCancel (context .Background ())
213203 if aggPeers != "none" {
214204 config .P2P .Peers = strings .Join (peersList , "," )
215205 }
216206 config .P2P .ListenAddress = fmt .Sprintf ("/ip4/127.0.0.1/tcp/%d" , 40001 + i )
217207 config .RPC .Address = fmt .Sprintf ("127.0.0.1:%d" , 8001 + i )
218208 executor , sequencer , _ , p2pClient , _ , nodeP2PKey , stopDAHeightTicker := createTestComponents (t , config )
219209 node , err := NewNode (
220- ctx ,
221210 config ,
222211 executor ,
223212 sequencer ,
@@ -233,8 +222,6 @@ func createNodesWithCleanup(t *testing.T, num int, config evconfig.Config) ([]*F
233222 require .NoError (err )
234223 // Update cleanup to cancel the context instead of calling Stop
235224 cleanup := func () {
236- // Cancel the context to stop the node
237- cancel ()
238225 stopDAHeightTicker ()
239226 }
240227 nodes [i ], cleanups [i ] = node .(* FullNode ), cleanup
0 commit comments