@@ -105,25 +105,30 @@ func doPOR(config *Config, runtime cre.Runtime, runTime time.Time) (string, erro
105105
106106 logger .Info ("ReserveInfo" , "reserveInfo" , reserveInfo )
107107
108- confHttpClient := & confidentialhttp.Client {}
109- confOutput , err := confidentialhttp .SendRequest (
110- config ,
111- runtime ,
112- confHttpClient ,
113- fetchPORConfidential ,
114- cre .ConsensusIdenticalAggregation [* confidentialhttp.HTTPResponse ](),
108+ porResp , err := cre .RunInNodeMode (* config , runtime ,
109+ func (config Config , nodeRuntime cre.NodeRuntime ) (PORResponse , error ) {
110+ confHttpClient := confidentialhttp.Client {}
111+ confOutput , err := confHttpClient .SendRequest (nodeRuntime , & confidentialhttp.ConfidentialHTTPRequest {
112+ Request : & confidentialhttp.HTTPRequest {
113+ Url : config .URL ,
114+ Method : "GET" ,
115+ },
116+ EncryptOutput : true ,
117+ }).Await ()
118+ if err != nil {
119+ logger .Error ("error fetching conf por" , "err" , err )
120+ return PORResponse {}, err
121+ }
122+ logger .Info ("Conf POR response" , "response" , confOutput )
123+
124+ porResp := & PORResponse {}
125+ if err = json .Unmarshal (confOutput .Body , porResp ); err != nil {
126+ return PORResponse {}, err
127+ }
128+
129+ return * porResp , nil
130+ }, cre .ConsensusIdenticalAggregation [PORResponse ](),
115131 ).Await ()
116- if err != nil {
117- logger .Error ("error fetching conf por" , "err" , err )
118- return "" , err
119- }
120- logger .Info ("Conf POR response" , "response" , confOutput )
121-
122- // Compare responses
123- porResp := & PORResponse {}
124- if err = json .Unmarshal (confOutput .Body , porResp ); err != nil {
125- return "" , err
126- }
127132
128133 if porResp .Ripcord {
129134 return "" , errors .New ("ripcord is true" )
@@ -272,16 +277,6 @@ func updateReserves(config *Config, runtime cre.Runtime, totalSupply *big.Int, t
272277 return nil
273278}
274279
275- func fetchPORConfidential (config * Config , logger * slog.Logger , sendRequester * confidentialhttp.SendRequester ) (* confidentialhttp.HTTPResponse , error ) {
276- return sendRequester .SendRequest (& confidentialhttp.ConfidentialHTTPRequest {
277- Request : & confidentialhttp.HTTPRequest {
278- Url : config .URL ,
279- Method : "GET" ,
280- },
281- // No Vault DON Secrets in this example
282- }).Await ()
283- }
284-
285280func fetchPOR (config * Config , logger * slog.Logger , sendRequester * http.SendRequester ) (* ReserveInfo , error ) {
286281 httpActionOut , err := sendRequester .SendRequest (& http.Request {
287282 Method : "GET" ,
0 commit comments