Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsFunny committed Feb 18, 2024
1 parent 6918b06 commit ecc592e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,20 @@ 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(
Expand Down Expand Up @@ -1698,15 +1702,15 @@ impl Server {
}

async fn simulate_brc20(
Extension(client): Extension<Arc<Client>>,
Extension(client): Extension<Option<Arc<Client>>>,
Extension(simulator): Extension<Option<SimulatorServer>>,
Path(tx_id): Path<Txid>,
) -> ApiResult<Vec<Receipt>> {
if simulator.is_none() {
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()));
}
Expand Down

0 comments on commit ecc592e

Please sign in to comment.