Skip to content

Commit

Permalink
Use bitcoincore-rpc 0.14.0 release
Browse files Browse the repository at this point in the history
Since it now uses `bitcoin` 0.27
  • Loading branch information
romanz committed Sep 23, 2021
1 parent 5ae3d65 commit 7c55c78
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 deletions.
50 changes: 25 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec = "internal/config_specification.toml"
[dependencies]
anyhow = "1.0"
bitcoin = { version = "0.27.1", features = ["use-serde", "rand"] }
bitcoincore-rpc = "0.14.0"
configure_me = "0.4"
crossbeam-channel = "0.5"
dirs-next = "2.0"
Expand All @@ -36,9 +37,6 @@ serde_json = "1.0"
signal-hook = "0.3"
tiny_http = { version = "0.8", optional = true }

[dependencies.core-rpc]
version = "0.15.0" # Use bitcoincore-rpc fork for now

[dependencies.electrs-rocksdb]
# support building with Rust 1.41.1 and workaround the following issues:
# https://github.com/romanz/electrs/issues/403 (support building on ARM 32-bit)
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bitcoin::network::constants::Network;
use core_rpc::Auth;
use bitcoincore_rpc::Auth;
use dirs_next::home_dir;

use std::ffi::{OsStr, OsString};
Expand Down
10 changes: 6 additions & 4 deletions src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use anyhow::{Context, Result};
use bitcoin::{
consensus::serialize, hashes::hex::ToHex, Amount, Block, BlockHash, Transaction, Txid,
};
use core_rpc::{json, jsonrpc, Auth, Client, RpcApi};
use bitcoincore_rpc::{json, jsonrpc, Auth, Client, RpcApi};
use parking_lot::Mutex;
use serde_json::{json, Value};

Expand Down Expand Up @@ -224,10 +224,12 @@ impl Daemon {
}
}

pub(crate) type RpcError = core_rpc::jsonrpc::error::RpcError;
pub(crate) type RpcError = bitcoincore_rpc::jsonrpc::error::RpcError;

pub(crate) fn extract_bitcoind_error(err: &core_rpc::Error) -> Option<&RpcError> {
use core_rpc::{jsonrpc::error::Error::Rpc as ServerError, Error::JsonRpc as JsonRpcError};
pub(crate) fn extract_bitcoind_error(err: &bitcoincore_rpc::Error) -> Option<&RpcError> {
use bitcoincore_rpc::{
jsonrpc::error::Error::Rpc as ServerError, Error::JsonRpc as JsonRpcError,
};
match err {
JsonRpcError(ServerError(e)) => Some(e),
_ => None,
Expand Down
2 changes: 1 addition & 1 deletion src/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ impl Rpc {
Err(err) => {
warn!("RPC {} failed: {:#}", method, err);
match err
.downcast_ref::<core_rpc::Error>()
.downcast_ref::<bitcoincore_rpc::Error>()
.and_then(extract_bitcoind_error)
{
Some(e) => error_msg(id, RpcError::DaemonError(e.clone())),
Expand Down
2 changes: 1 addition & 1 deletion src/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::ops::Bound;

use bitcoin::hashes::Hash;
use bitcoin::{Amount, OutPoint, Transaction, Txid};
use core_rpc::json;
use bitcoincore_rpc::json;
use rayon::prelude::*;
use serde::ser::{Serialize, SerializeSeq, Serializer};

Expand Down
2 changes: 1 addition & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::{Context, Result};
use bitcoin::BlockHash;
use core_rpc::RpcApi;
use bitcoincore_rpc::RpcApi;
use crossbeam_channel::{bounded, select, unbounded, Receiver, Sender};
use rayon::prelude::*;

Expand Down

0 comments on commit 7c55c78

Please sign in to comment.