mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Simplify GET request for block tip height
This commit is contained in:
parent
e9d7d9299c
commit
08923a14f3
@ -12,7 +12,7 @@ use bdk::electrum_client::{self, Client, ElectrumApi};
|
|||||||
use bdk::keys::DerivableKey;
|
use bdk::keys::DerivableKey;
|
||||||
use bdk::{FeeRate, KeychainKind};
|
use bdk::{FeeRate, KeychainKind};
|
||||||
use bitcoin::Script;
|
use bitcoin::Script;
|
||||||
use reqwest::{Method, Url};
|
use reqwest::Url;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -226,10 +226,9 @@ impl Wallet {
|
|||||||
|
|
||||||
pub async fn get_block_height(&self) -> Result<BlockHeight> {
|
pub async fn get_block_height(&self) -> Result<BlockHeight> {
|
||||||
let url = make_blocks_tip_height_url(&self.http_url)?;
|
let url = make_blocks_tip_height_url(&self.http_url)?;
|
||||||
|
|
||||||
let height = retry(ConstantBackoff::new(Duration::from_secs(1)), || async {
|
let height = retry(ConstantBackoff::new(Duration::from_secs(1)), || async {
|
||||||
let height = reqwest::Client::new()
|
let height = reqwest::get(url.clone())
|
||||||
.request(Method::GET, url.clone())
|
|
||||||
.send()
|
|
||||||
.await
|
.await
|
||||||
.map_err(Error::Io)?
|
.map_err(Error::Io)?
|
||||||
.text()
|
.text()
|
||||||
|
Loading…
Reference in New Issue
Block a user