mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-01 04:56:41 -05:00
Use RwLock instead of Mutex to allow for parallel reads and add get_current_swap endpoint
This commit is contained in:
parent
849e6e7a14
commit
ffbbe24010
2 changed files with 24 additions and 10 deletions
|
|
@ -156,6 +156,9 @@ pub fn register_modules(context: Arc<Context>) -> RpcModule<Arc<Context>> {
|
|||
list_sellers(rendezvous_point.clone(), &context).await
|
||||
})
|
||||
.expect("Could not register RPC method list_sellers");
|
||||
module.register_async_method("get_current_swap", |_, context| async move {
|
||||
get_current_swap(&context).await
|
||||
}).expect("Could not register RPC method get_current_swap");
|
||||
module
|
||||
}
|
||||
|
||||
|
|
@ -170,6 +173,10 @@ async fn execute_request(
|
|||
.map_err(|err| jsonrpsee_core::Error::Custom(err.to_string()))
|
||||
}
|
||||
|
||||
async fn get_current_swap(context: &Arc<Context>) -> Result<serde_json::Value, jsonrpsee_core::Error> {
|
||||
execute_request(Method::GetCurrentSwap, context).await
|
||||
}
|
||||
|
||||
async fn get_bitcoin_balance(
|
||||
context: &Arc<Context>,
|
||||
) -> Result<serde_json::Value, jsonrpsee_core::Error> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue