@@ -23,8 +23,8 @@ public async Task<ActionResult<GoalVersion>> GoalVersion()
23
23
string installed = string . Empty ;
24
24
string latest = string . Empty ;
25
25
26
- string goalPath = Path . Combine ( Utils . appDataDir , "bin" , "goal " ) ;
27
- string version = await Utils . ExecCmd ( $ "{ goalPath } --version ") ;
26
+ string algodPath = Path . Combine ( Utils . appDataDir , "bin" , "algod " ) ;
27
+ string version = await Utils . ExecCmd ( $ "{ algodPath } -v ") ;
28
28
if ( version != string . Empty )
29
29
{
30
30
int firstBreak = version . IndexOf ( "\n " ) + 1 ;
@@ -128,11 +128,35 @@ public async Task<ActionResult<string>> GoalUpdate(Models.Release model)
128
128
await s . CopyToAsync ( fs ) ;
129
129
fs . Dispose ( ) ;
130
130
131
+ // Get Node Statuses
132
+ var algorandStatus = await Node . Get ( "algorand" ) ;
133
+ var voiStatus = await Node . Get ( "voi" ) ;
134
+
135
+ // Stop Running Nodes
136
+ if ( algorandStatus . ServiceStatus == "Running" )
137
+ {
138
+ await Node . ControlService ( "algorand" , "stop" ) ;
139
+ }
140
+ if ( voiStatus . ServiceStatus == "Running" )
141
+ {
142
+ await Node . ControlService ( "voi" , "stop" ) ;
143
+ }
144
+
131
145
using FileStream rfs = new ( filePath , System . IO . FileMode . Open , FileAccess . Read ) ;
132
146
using GZipStream gz = new ( rfs , CompressionMode . Decompress , leaveOpen : true ) ;
133
147
await TarFile . ExtractToDirectoryAsync ( gz , Utils . appDataDir , true ) ;
134
148
rfs . Dispose ( ) ;
135
149
150
+ // Restart Running Nodes
151
+ if ( algorandStatus . ServiceStatus == "Running" )
152
+ {
153
+ await Node . ControlService ( "algorand" , "start" ) ;
154
+ }
155
+ if ( voiStatus . ServiceStatus == "Running" )
156
+ {
157
+ await Node . ControlService ( "voi" , "start" ) ;
158
+ }
159
+
136
160
System . IO . File . Delete ( filePath ) ;
137
161
138
162
return Ok ( ) ;
0 commit comments