@@ -27,10 +27,7 @@ import (
27
27
"github.com/ava-labs/avalanchego/utils/perms"
28
28
)
29
29
30
- var (
31
- errProcessNotRunning = errors .New ("process not running" )
32
- errNodeAlreadyRunning = errors .New ("failed to start local node: node is already running" )
33
- )
30
+ var errNodeAlreadyRunning = errors .New ("failed to start local node: node is already running" )
34
31
35
32
// Defines local-specific node configuration. Supports setting default
36
33
// and node-specific values.
@@ -268,7 +265,7 @@ func (n *LocalNode) Stop() error {
268
265
}
269
266
270
267
// Wait for the node process to stop
271
- ticker := time .NewTicker (DefaultNodeTickerInterval )
268
+ ticker := time .NewTicker (testnet . DefaultNodeTickerInterval )
272
269
defer ticker .Stop ()
273
270
ctx , cancel := context .WithTimeout (context .Background (), DefaultNodeStopTimeout )
274
271
defer cancel ()
@@ -298,7 +295,7 @@ func (n *LocalNode) IsHealthy(ctx context.Context) (bool, error) {
298
295
return false , fmt .Errorf ("failed to determine process status: %w" , err )
299
296
}
300
297
if proc == nil {
301
- return false , errProcessNotRunning
298
+ return false , testnet . ErrNotRunning
302
299
}
303
300
304
301
// Check that the node is reporting healthy
@@ -323,33 +320,8 @@ func (n *LocalNode) IsHealthy(ctx context.Context) (bool, error) {
323
320
return false , fmt .Errorf ("failed to query node health: %w" , err )
324
321
}
325
322
326
- // WaitForHealthy blocks until IsHealthy returns true or an error (including context timeout) is observed.
327
- func (n * LocalNode ) WaitForHealthy (ctx context.Context ) error {
328
- if _ , ok := ctx .Deadline (); ! ok {
329
- return fmt .Errorf ("unable to wait for health for node %q with a context without a deadline" , n .NodeID )
330
- }
331
- ticker := time .NewTicker (DefaultNodeTickerInterval )
332
- defer ticker .Stop ()
333
-
334
- for {
335
- healthy , err := n .IsHealthy (ctx )
336
- if err != nil && ! errors .Is (err , errProcessNotRunning ) {
337
- return fmt .Errorf ("failed to wait for health of node %q: %w" , n .NodeID , err )
338
- }
339
- if healthy {
340
- return nil
341
- }
342
-
343
- select {
344
- case <- ctx .Done ():
345
- return fmt .Errorf ("failed to wait for health of node %q before timeout: %w" , n .NodeID , ctx .Err ())
346
- case <- ticker .C :
347
- }
348
- }
349
- }
350
-
351
323
func (n * LocalNode ) WaitForProcessContext (ctx context.Context ) error {
352
- ticker := time .NewTicker (DefaultNodeTickerInterval )
324
+ ticker := time .NewTicker (testnet . DefaultNodeTickerInterval )
353
325
defer ticker .Stop ()
354
326
355
327
ctx , cancel := context .WithTimeout (ctx , DefaultNodeInitTimeout )
0 commit comments