Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit d001daf

Browse files
committed
WIP: Track rust-bitcoin master branch
As we develop `primitives` it is useful to have crates using the changes to catch mistakes as we go. The crates in this repo are prime candidates for depending on `primitives` and not using `rust-bitcoin`.
1 parent 53f679a commit d001daf

File tree

10 files changed

+119
-18
lines changed

10 files changed

+119
-18
lines changed

Cargo.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,53 @@ path = "json"
1111

1212
[patch.crates-io.jsonrpc]
1313
path = "jsonrpc"
14+
15+
16+
[patch.crates-io.base58ck]
17+
path = "../../rust-bitcoin/10-18-consensus-error/base58"
18+
19+
[patch.crates-io.bitcoin]
20+
path = "../../rust-bitcoin/10-18-consensus-error/bitcoin"
21+
22+
[patch.crates-io.bitcoin_hashes]
23+
path = "../../rust-bitcoin/10-18-consensus-error/hashes"
24+
25+
[patch.crates-io.bitcoin-internals]
26+
path = "../../rust-bitcoin/10-18-consensus-error/internals"
27+
28+
[patch.crates-io.bitcoin-io]
29+
path = "../../rust-bitcoin/10-18-consensus-error/io"
30+
31+
[patch.crates-io.bitcoin-primitives]
32+
path = "../../rust-bitcoin/10-18-consensus-error/primitives"
33+
34+
[patch.crates-io.bitcoin-units]
35+
path = "../../rust-bitcoin/10-18-consensus-error/units"
36+
37+
# [patch.crates-io.base58ck]
38+
# git = "https://github.com/tcharding/rust-bitcoin"
39+
# branch = "10-16-set-version-to-alpha"
40+
41+
# [patch.crates-io.bitcoin]
42+
# git = "https://github.com/tcharding/rust-bitcoin"
43+
# branch = "10-16-set-version-to-alpha"
44+
45+
# [patch.crates-io.bitcoin_hashes]
46+
# git = "https://github.com/tcharding/rust-bitcoin"
47+
# branch = "10-16-set-version-to-alpha"
48+
49+
# [patch.crates-io.bitcoin-internals]
50+
# git = "https://github.com/tcharding/rust-bitcoin"
51+
# branch = "10-16-set-version-to-alpha"
52+
53+
# [patch.crates-io.bitcoin-io]
54+
# git = "https://github.com/tcharding/rust-bitcoin"
55+
# branch = "10-16-set-version-to-alpha"
56+
57+
# [patch.crates-io.bitcoin-primitives]
58+
# git = "https://github.com/tcharding/rust-bitcoin"
59+
# branch = "10-16-set-version-to-alpha"
60+
61+
# [patch.crates-io.bitcoin-units]
62+
# git = "https://github.com/tcharding/rust-bitcoin"
63+
# branch = "10-16-set-version-to-alpha"

client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ rustdoc-args = ["--cfg", "docsrs"]
2626
client-sync = ["jsonrpc"]
2727

2828
[dependencies]
29-
bitcoin = { version = "0.32.0", default-features = false, features = ["std", "serde"] }
29+
bitcoin = { version = "0.33.0-alpha", default-features = false, features = ["std", "serde"] }
3030
json = { package = "bitcoind-json-rpc-types", version = "0.3.0", default-features = false, features = [] }
3131
log = "0.4"
3232
serde = { version = "1.0.103", default-features = false, features = [ "derive", "alloc" ] }

integration_test/Cargo.toml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ edition = "2021"
5050
"v17" = []
5151

5252
[dependencies]
53-
bitcoin = { version = "0.32.0", default-features = false, features = ["std", "serde"] }
53+
bitcoin = { version = "0.33.0-alpha", default-features = false, features = ["std", "serde"] }
5454
client = { package = "bitcoind-json-rpc-client", version = "0.3.0", default-features = false, features = ["client-sync"] }
5555
bitcoind = { package = "bitcoind-json-rpc-regtest", version = "0.3.0", default-features = false, features = [] }
5656
rand = "0.8.5"
@@ -66,3 +66,32 @@ path = "../json"
6666

6767
[patch.crates-io.bitcoind-json-rpc-regtest]
6868
path = "../regtest"
69+
70+
71+
[patch.crates-io.base58ck]
72+
git = "https://github.com/tcharding/rust-bitcoin"
73+
branch = "10-18-consensus-error"
74+
75+
[patch.crates-io.bitcoin]
76+
git = "https://github.com/tcharding/rust-bitcoin"
77+
branch = "10-18-consensus-error"
78+
79+
[patch.crates-io.bitcoin_hashes]
80+
git = "https://github.com/tcharding/rust-bitcoin"
81+
branch = "10-18-consensus-error"
82+
83+
[patch.crates-io.bitcoin-internals]
84+
git = "https://github.com/tcharding/rust-bitcoin"
85+
branch = "10-18-consensus-error"
86+
87+
[patch.crates-io.bitcoin-io]
88+
git = "https://github.com/tcharding/rust-bitcoin"
89+
branch = "10-18-consensus-error"
90+
91+
[patch.crates-io.bitcoin-primitives]
92+
git = "https://github.com/tcharding/rust-bitcoin"
93+
branch = "10-18-consensus-error"
94+
95+
[patch.crates-io.bitcoin-units]
96+
git = "https://github.com/tcharding/rust-bitcoin"
97+
branch = "10-18-consensus-error"

json/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ exclude = ["tests", "contrib"]
2121
default = []
2222

2323
[dependencies]
24-
bitcoin = { version = "0.32.0", default-features = false, features = ["std", "serde"] }
25-
internals = { package = "bitcoin-internals", version = "0.3.0", default-features = false, features = ["std"] }
24+
bitcoin = { version = "0.33.0-alpha", default-features = false, features = ["std", "serde"] }
25+
internals = { package = "bitcoin-internals", version = "0.4.0", default-features = false, features = ["std"] }
2626
serde = { version = "1.0.103", default-features = false, features = [ "derive", "alloc" ] }
2727
serde_json = { version = "1.0.117" }
2828

json/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,3 @@ fn btc_per_kb(btc_per_kb: f64) -> Result<Option<FeeRate>, ParseAmountError> {
8282

8383
Ok(rate)
8484
}
85-

json/src/v17/blockchain.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ use std::fmt;
99
use std::str::FromStr;
1010

1111
use bitcoin::consensus::encode;
12-
use bitcoin::error::UnprefixedHexError;
1312
use bitcoin::hex::FromHex;
13+
use bitcoin::parse::UnprefixedHexError;
14+
use bitcoin::pow::CompactTargetExt as _;
15+
use bitcoin::script::ScriptBufExt as _;
1416
use bitcoin::{
1517
address, amount, block, hex, network, Address, Amount, Block, BlockHash, CompactTarget,
1618
FeeRate, Network, ScriptBuf, TxMerkleNode, TxOut, Txid, Weight, Work,
@@ -477,7 +479,7 @@ pub enum GetBlockHeaderError {
477479
/// Conversion of hex data to bytes failed.
478480
Hex(hex::HexToBytesError),
479481
/// Consensus decoding of bytes to header failed.
480-
Consensus(encode::Error),
482+
Consensus(encode::DeserializeError),
481483
}
482484

483485
impl fmt::Display for GetBlockHeaderError {

json/src/v19/blockchain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use core::fmt;
88
use std::collections::BTreeMap;
99

10-
use bitcoin::error::UnprefixedHexError;
10+
use bitcoin::parse::UnprefixedHexError;
1111
use bitcoin::{hex, network, BlockHash, Network, Work};
1212
use internals::write_err;
1313
use serde::{Deserialize, Serialize};

regtest/Cargo.toml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ serde_json = { version = "1.0.117" }
2424
env_logger = "0.9.0"
2525

2626
[build-dependencies]
27-
bitcoin_hashes = { version = ">= 0.13, <= 0.14", optional = true }
27+
bitcoin_hashes = { version = "0.15", optional = true }
2828
flate2 = { version = "1.0", optional = true }
2929
tar = { version = "0.4", optional = true }
3030
minreq = { version = "2.9.1", default-features = false, features = [
@@ -77,3 +77,32 @@ path = "../client"
7777

7878
[patch.crates-io.bitcoind-json-rpc-types]
7979
path = "../json"
80+
81+
82+
[patch.crates-io.base58ck]
83+
git = "https://github.com/tcharding/rust-bitcoin"
84+
branch = "10-18-consensus-error"
85+
86+
[patch.crates-io.bitcoin]
87+
git = "https://github.com/tcharding/rust-bitcoin"
88+
branch = "10-18-consensus-error"
89+
90+
[patch.crates-io.bitcoin_hashes]
91+
git = "https://github.com/tcharding/rust-bitcoin"
92+
branch = "10-18-consensus-error"
93+
94+
[patch.crates-io.bitcoin-internals]
95+
git = "https://github.com/tcharding/rust-bitcoin"
96+
branch = "10-18-consensus-error"
97+
98+
[patch.crates-io.bitcoin-io]
99+
git = "https://github.com/tcharding/rust-bitcoin"
100+
branch = "10-18-consensus-error"
101+
102+
[patch.crates-io.bitcoin-primitives]
103+
git = "https://github.com/tcharding/rust-bitcoin"
104+
branch = "10-18-consensus-error"
105+
106+
[patch.crates-io.bitcoin-units]
107+
git = "https://github.com/tcharding/rust-bitcoin"
108+
branch = "10-18-consensus-error"

regtest/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod download {
1616
use std::str::FromStr;
1717

1818
use anyhow::Context;
19-
use bitcoin_hashes::{sha256, Hash};
19+
use bitcoin_hashes::sha256;
2020
use flate2::read::GzDecoder;
2121
use tar::Archive;
2222

regtest/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ pub enum P2P {
112112

113113
/// All the possible error in this crate
114114
pub enum Error {
115-
/// Wrapper of io Error
116-
Io(std::io::Error),
117115
/// Wrapper of bitcoincore_rpc Error
118116
Rpc(client_sync::Error),
119117
/// Returned when calling methods requiring a feature to be activated, but it's not
@@ -141,7 +139,6 @@ impl fmt::Debug for Error {
141139
use Error::*;
142140

143141
match self {
144-
Io(_) => write!(f, "io::Error"), // FIXME: Use bitcoin-internals.
145142
Rpc(_) => write!(f, "bitcoin_rpc::Error"),
146143
NoFeature => write!(f, "Called a method requiring a feature to be set, but it's not"),
147144
NoEnvVar => write!(f, "Called a method requiring env var `BITCOIND_EXE` to be set, but it's not"),
@@ -164,7 +161,6 @@ impl std::error::Error for Error {
164161
use Error::*;
165162

166163
match *self {
167-
Error::Io(ref e) => Some(e),
168164
Error::Rpc(ref e) => Some(e),
169165
NoFeature
170166
| NoEnvVar
@@ -504,10 +500,6 @@ pub fn get_available_port() -> anyhow::Result<u16> {
504500
Ok(t.local_addr().map(|s| s.port())?)
505501
}
506502

507-
impl From<std::io::Error> for Error {
508-
fn from(e: std::io::Error) -> Self { Error::Io(e) }
509-
}
510-
511503
impl From<client_sync::Error> for Error {
512504
fn from(e: client_sync::Error) -> Self { Error::Rpc(e) }
513505
}

0 commit comments

Comments
 (0)