Skip to content

Commit

Permalink
Merge #75: Replace ureq with minreq for blocking
Browse files Browse the repository at this point in the history
6a598b2 ci: remove MSRV pinning for jobserver dependency (Steve Myers)
973c768 chore: remove deprecated get_header() function (Steve Myers)
df9c694 refactor(blocking): replace ureq with minreq (Steve Myers)

Pull request description:

  Taking this over from #57.

  So far just a few minor adjustments on top of #57. Tested that syncing LDK works with the updated blocking client (in addition to the tests here).

ACKs for top commit:
  notmandatory:
    ACK 6a598b2

Tree-SHA512: 19488ffbf19c59912c379ee77083ee56f7af7fd7b764f8e6c0b96f574d456a86cefdbacb6bf31dc8c1b3317e139a3ed1b54211c8ccfe55e5ad427c512a16b723
  • Loading branch information
notmandatory committed Mar 6, 2024
2 parents e5fb3a3 + 6a598b2 commit c487b31
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 341 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
features:
- default
- blocking
- blocking-https
- blocking-https-rustls
- blocking-https-native
- blocking-https-bundled
- async
- async-https
- async-https-native
Expand Down Expand Up @@ -53,7 +57,6 @@ jobs:
run: |
cargo update -p zstd-sys --precise "2.0.8+zstd.1.5.5"
cargo update -p time --precise "0.3.20"
cargo update -p jobserver --precise "0.1.26"
cargo update -p home --precise 0.5.5
- name: Build
run: cargo build --features ${{ matrix.features }} --no-default-features
Expand Down
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ serde = { version = "1.0", features = ["derive"] }
bitcoin = { version = "0.31.0", features = ["serde", "std"], default-features = false }
hex = { package = "hex-conservative", version = "*" }
log = "^0.4"
ureq = { version = "2.5.0", features = ["json"], optional = true }
minreq = { version = "2.11.0", features = ["json-using-serde"], optional = true }
reqwest = { version = "0.11", optional = true, default-features = false, features = ["json"] }

[dev-dependencies]
Expand All @@ -32,7 +32,11 @@ lazy_static = "1.4.0"

[features]
default = ["blocking", "async", "async-https"]
blocking = ["ureq", "ureq/socks-proxy"]
blocking = ["minreq", "minreq/proxy"]
blocking-https = ["blocking", "minreq/https"]
blocking-https-rustls = ["blocking", "minreq/https-rustls"]
blocking-https-native = ["blocking", "minreq/https-native"]
blocking-https-bundled = ["blocking", "minreq/https-bundled"]
async = ["reqwest", "reqwest/socks"]
async-https = ["async", "reqwest/default-tls"]
async-https-native = ["async", "reqwest/native-tls"]
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,4 @@ Bitcoin Esplora API client library. Supports plaintext, TLS and Onion servers. B
</p>

## Minimum Supported Rust Version (MSRV)
This library should compile with any combination of features with Rust 1.63.0.

To build with the MSRV you will need to pin dependencies as follows:

```shell
cargo update -p jobserver --precise "0.1.26"
```
This library should compile with any combination of features with Rust 1.63.0.
4 changes: 3 additions & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
pub use bitcoin::consensus::{deserialize, serialize};
pub use bitcoin::hex::FromHex;
pub use bitcoin::{transaction, Amount, BlockHash, OutPoint, ScriptBuf, Transaction, TxIn, TxOut, Txid, Witness};
pub use bitcoin::{
transaction, Amount, BlockHash, OutPoint, ScriptBuf, Transaction, TxIn, TxOut, Txid, Witness,
};

use serde::Deserialize;

Expand Down
12 changes: 1 addition & 11 deletions src/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use std::collections::HashMap;
use std::str::FromStr;

use bitcoin::consensus::{deserialize, serialize};
use bitcoin::hex::{DisplayHex, FromHex};
use bitcoin::hashes::{sha256, Hash};
use bitcoin::hex::{DisplayHex, FromHex};
use bitcoin::{
block::Header as BlockHeader, Block, BlockHash, MerkleBlock, Script, Transaction, Txid,
};
Expand Down Expand Up @@ -131,16 +131,6 @@ impl AsyncClient {
}
}

#[deprecated(
since = "0.2.0",
note = "Deprecated to improve alignment with Esplora API. Users should use `get_block_hash` and `get_header_by_hash` methods directly."
)]
/// Get a [`BlockHeader`] given a particular block height.
pub async fn get_header(&self, block_height: u32) -> Result<BlockHeader, Error> {
let block_hash = self.get_block_hash(block_height).await?;
self.get_header_by_hash(&block_hash).await
}

/// Get a [`BlockHeader`] given a particular block hash.
pub async fn get_header_by_hash(&self, block_hash: &BlockHash) -> Result<BlockHeader, Error> {
let resp = self
Expand Down
Loading

0 comments on commit c487b31

Please sign in to comment.