diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 388d9ef36e..dc3f6e62cc 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -208,16 +208,21 @@ impl Server { }); INDEXER.lock().unwrap().replace(index_thread); - let client = Arc::new( - Client::new( - options.rpc_url.as_ref().unwrap().as_ref(), - Auth::UserPass( - options.bitcoin_rpc_user.as_ref().unwrap().clone(), - options.bitcoin_rpc_pass.as_ref().unwrap().clone(), - ), - ) - .unwrap(), - ); + + let client = if options.simulate_enable{ + Some(Arc::new( + Client::new( + options.simulate_bitcoin_rpc_url.as_ref().unwrap().as_ref(), + Auth::UserPass( + options.simulate_bitcoin_rpc_user.as_ref().unwrap().clone(), + options.simulate_bitcoin_rpc_pass.as_ref().unwrap().clone(), + ), + ) + .unwrap(), + )) + }else{ + None + }; #[derive(OpenApi)] #[openapi( @@ -1698,7 +1703,7 @@ impl Server { } async fn simulate_brc20( - Extension(client): Extension>, + Extension(client): Extension>>, Extension(simulator): Extension>, Path(tx_id): Path, ) -> ApiResult> { @@ -1706,7 +1711,7 @@ impl Server { return Err(ApiError::Internal("simulator not enabled".to_string())); } - let tx = client.get_raw_transaction(&tx_id, None); + let tx = client.unwrap().get_raw_transaction(&tx_id, None); if tx.is_err() { return Err(ApiError::NotFound("tx not found".to_string())); }