Simplify GET request for block tip height

This commit is contained in:
Thomas Eizinger 2021-03-05 17:06:17 +11:00
parent e9d7d9299c
commit 08923a14f3
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

View File

@ -12,7 +12,7 @@ use bdk::electrum_client::{self, Client, ElectrumApi};
use bdk::keys::DerivableKey;
use bdk::{FeeRate, KeychainKind};
use bitcoin::Script;
use reqwest::{Method, Url};
use reqwest::Url;
use serde::{Deserialize, Serialize};
use std::path::Path;
use std::sync::Arc;
@ -226,10 +226,9 @@ impl Wallet {
pub async fn get_block_height(&self) -> Result<BlockHeight> {
let url = make_blocks_tip_height_url(&self.http_url)?;
let height = retry(ConstantBackoff::new(Duration::from_secs(1)), || async {
let height = reqwest::Client::new()
.request(Method::GET, url.clone())
.send()
let height = reqwest::get(url.clone())
.await
.map_err(Error::Io)?
.text()