Skip to content

Commit

Permalink
Upgrade to tokio 1.0
Browse files Browse the repository at this point in the history
Upgrade jsonrpc_client to version that uses reqwest 0.11 and tokio 1.0.

Fix tests
  • Loading branch information
rishflab committed Jan 17, 2021
1 parent f3fbbba commit ae2f6cd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ bitcoin = { version = "0.25", features = ["use-serde"] }
bitcoincore-rpc-json = "0.12"
futures = "0.3.5"
hex = "0.4.2"
jsonrpc_client = { git = "https://github.com/thomaseizinger/rust-jsonrpc-client", rev = "c7010817e0f86ab24b3dc10d6bb0463faa0aace4", features = ["reqwest"] }
reqwest = { version = "0.10", default-features = false, features = ["json", "native-tls"] }
jsonrpc_client = { git = "https://github.com/thomaseizinger/rust-jsonrpc-client", rev = "f60c839481c1ac68909ada0141a3a3bf085bb1af", features = ["reqwest"] }
reqwest = { version = "0.11", default-features = false, features = ["json", "native-tls"] }
serde = "1.0"
serde_json = "1.0"
testcontainers = "0.11"
thiserror = "1.0"
tokio = { version = "0.2", default-features = false, features = ["blocking", "macros", "rt-core", "time"] }
tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "macros", "time"] }
tracing = "0.1"
url = "2"

Expand Down
4 changes: 2 additions & 2 deletions src/bitcoind_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ mod test {
use crate::Bitcoind;
use std::time::Duration;
use testcontainers::clients;
use tokio::time::delay_for;
use tokio::time::sleep;

#[tokio::test]
async fn get_network_info() {
Expand Down Expand Up @@ -267,7 +267,7 @@ mod test {
let client = Client::new(bitcoind.node_url.clone());

let height_0 = client.getblockcount().await.unwrap();
delay_for(Duration::from_secs(2)).await;
sleep(Duration::from_secs(2)).await;

let height_1 = client.getblockcount().await.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl<'c> Bitcoind<'c> {

async fn mine(bitcoind_client: Client, reward_address: bitcoin::Address) -> Result<()> {
loop {
tokio::time::delay_for(Duration::from_secs(1)).await;
tokio::time::sleep(Duration::from_secs(1)).await;
bitcoind_client
.generatetoaddress(1, reward_address.clone(), None)
.await?;
Expand Down
4 changes: 2 additions & 2 deletions src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ mod test {
use crate::{Bitcoind, Wallet};
use bitcoin::util::psbt::PartiallySignedTransaction;
use bitcoin::{Amount, Transaction, TxOut};
use tokio::time::delay_for;
use tokio::time::sleep;

#[tokio::test]
async fn get_wallet_transaction() {
Expand Down Expand Up @@ -304,7 +304,7 @@ mod test {
// wait for the transaction to be included in a block, so that
// it has a block height field assigned to it when calling
// `getrawtransaction`
delay_for(Duration::from_secs(2)).await;
sleep(Duration::from_secs(2)).await;

let _res = wallet.transaction_block_height(txid).await.unwrap();
}
Expand Down

0 comments on commit ae2f6cd

Please sign in to comment.