@@ -57,8 +57,7 @@ pub struct HttpServer {
5757
5858#[ derive( Clone ) ]
5959pub struct AppState {
60- // TODO(Tsabary): use the config manager in the tx processing.
61- _config_manager_client : SharedConfigManagerClient ,
60+ config_manager_client : SharedConfigManagerClient ,
6261 pub gateway_client : SharedGatewayClient ,
6362}
6463
@@ -68,7 +67,7 @@ impl HttpServer {
6867 config_manager_client : SharedConfigManagerClient ,
6968 gateway_client : SharedGatewayClient ,
7069 ) -> Self {
71- let app_state = AppState { _config_manager_client : config_manager_client, gateway_client } ;
70+ let app_state = AppState { config_manager_client, gateway_client } ;
7271 HttpServer { config, app_state }
7372 }
7473
@@ -93,8 +92,7 @@ impl HttpServer {
9392 . with_state ( self . app_state . clone ( ) )
9493 // Rest api endpoint
9594 . route ( "/gateway/add_transaction" , post ( {
96- let max_sierra_program_size = self . config . dynamic_config . max_sierra_program_size ;
97- move |app_state : State < AppState > , headers : HeaderMap , tx : String | add_tx ( app_state, headers, tx, max_sierra_program_size)
95+ move |app_state : State < AppState > , headers : HeaderMap , tx : String | add_tx ( app_state, headers, tx)
9896 } ) )
9997 . with_state ( self . app_state . clone ( ) )
10098 // TODO(shahak): Remove this once we fix the centralized simulator to not use is_alive
@@ -129,11 +127,12 @@ async fn add_tx(
129127 State ( app_state) : State < AppState > ,
130128 headers : HeaderMap ,
131129 tx : String ,
132- max_sierra_program_size : usize ,
133130) -> HttpServerResult < Json < GatewayOutput > > {
134131 ADDED_TRANSACTIONS_TOTAL . increment ( 1 ) ;
135132 debug ! ( "ADD_TX_START: Http server received a new transaction." ) ;
136133
134+ let dynamic_config = app_state. config_manager_client . get_http_server_dynamic_config ( ) . await ?;
135+
137136 let tx: DeprecatedGatewayTransactionV3 = match serde_json:: from_str ( & tx) {
138137 Ok ( value) => value,
139138 Err ( e) => {
@@ -148,7 +147,7 @@ async fn add_tx(
148147 }
149148 } ;
150149
151- let rpc_tx = tx. convert_to_rpc_tx ( max_sierra_program_size) . inspect_err ( |e| {
150+ let rpc_tx = tx. convert_to_rpc_tx ( dynamic_config . max_sierra_program_size ) . inspect_err ( |e| {
152151 debug ! ( "Error while converting deprecated gateway transaction into RPC transaction: {}" , e) ;
153152 } ) ?;
154153
0 commit comments