@@ -58,7 +58,7 @@ func (p *ProcessRuntime) setProcessContext(processContext node.ProcessContext) {
58
58
p .node .StakingAddress = processContext .StakingAddress
59
59
}
60
60
61
- func (p * ProcessRuntime ) readState () error {
61
+ func (p * ProcessRuntime ) readState (_ context. Context ) error {
62
62
path := p .getProcessContextPath ()
63
63
bytes , err := os .ReadFile (path )
64
64
if errors .Is (err , fs .ErrNotExist ) {
@@ -81,7 +81,7 @@ func (p *ProcessRuntime) readState() error {
81
81
// its staking port. The network will start faster with this
82
82
// synchronization due to the avoidance of exponential backoff
83
83
// if a node tries to connect to a beacon that is not ready.
84
- func (p * ProcessRuntime ) Start () error {
84
+ func (p * ProcessRuntime ) Start (ctx context. Context ) error {
85
85
log := p .node .network .log
86
86
87
87
// Avoid attempting to start an already running node.
@@ -122,7 +122,7 @@ func (p *ProcessRuntime) Start() error {
122
122
// a configuration error preventing startup. Such a log entry will be provided to the
123
123
// cancelWithCause function so that waitForProcessContext can exit early with an error
124
124
// that includes the log entry.
125
- ctx , cancelWithCause := context .WithCancelCause (context . Background () )
125
+ ctx , cancelWithCause := context .WithCancelCause (ctx )
126
126
defer cancelWithCause (nil )
127
127
logPath := p .node .DataDir + "/logs/main.log"
128
128
go watchLogFileForFatal (ctx , cancelWithCause , log , logPath )
@@ -145,7 +145,7 @@ func (p *ProcessRuntime) Start() error {
145
145
}
146
146
147
147
// Signals the node process to stop.
148
- func (p * ProcessRuntime ) InitiateStop () error {
148
+ func (p * ProcessRuntime ) InitiateStop (_ context. Context ) error {
149
149
proc , err := p .getProcess ()
150
150
if err != nil {
151
151
return fmt .Errorf ("failed to retrieve process to stop: %w" , err )
@@ -211,7 +211,7 @@ func (p *ProcessRuntime) waitForProcessContext(ctx context.Context) error {
211
211
ctx , cancel := context .WithTimeout (ctx , defaultNodeInitTimeout )
212
212
defer cancel ()
213
213
for len (p .node .URI ) == 0 {
214
- err := p .readState ()
214
+ err := p .readState (ctx )
215
215
if err != nil {
216
216
return fmt .Errorf ("failed to read process context for node %q: %w" , p .node .NodeID , err )
217
217
}
@@ -229,9 +229,11 @@ func (p *ProcessRuntime) waitForProcessContext(ctx context.Context) error {
229
229
// process liveness, the node's process context will be refreshed if
230
230
// live or cleared if not running.
231
231
func (p * ProcessRuntime ) getProcess () (* os.Process , error ) {
232
+ // This context is not used but a non-nil value must be supplied to satisfy the linter
233
+ ctx := context .TODO ()
232
234
// Read the process context to ensure freshness. The node may have
233
235
// stopped or been restarted since last read.
234
- if err := p .readState (); err != nil {
236
+ if err := p .readState (ctx ); err != nil {
235
237
return nil , fmt .Errorf ("failed to read process context: %w" , err )
236
238
}
237
239
0 commit comments