Skip to content

error with bitcoincore-json dependency #159

Open
@fedejinich

Description

@fedejinich

Hi, I'm trying to setup a local regtest node and I'm using this crate. When compiling I get an error in a bitcoind dependency (bitcoincorerpc-json):

warning: skipping duplicate package `embedded` found at `/Users/fedejinich/.cargo/git/checkouts/rust-bitcoin-152ce3c54035dc85/48efda9/bitcoin/embedded`
   Compiling bitcoincore-rpc v0.18.0
error[E0277]: `?` couldn't convert the error to `error::Error`
  --> /Users/fedejinich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitcoincore-rpc-0.18.0/src/lib.rs:42:47
   |
41 | fn deserialize_hex<T: Decodable>(hex: &str) -> Result<T> {
   |                                                --------- expected `error::Error` because of this
42 |     let mut reader = HexToBytesIter::new(&hex)?;
   |                      -------------------------^ the trait `From<OddLengthStringError>` is not implemented for `error::Error`, which is required by `std::result::Result<T, error::Error>: FromResidual<std::result::Result<Infallible, OddLengthStringError>>`
   |                      |
   |                      this can't be annotated with `?` because it has type `Result<_, OddLengthStringError>`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = help: the following other types implement trait `From<T>`:
             <error::Error as From<HexToBytesError>>
             <error::Error as From<ParseAmountError>>
             <error::Error as From<bitcoincore_rpc_json::bitcoin::consensus::encode::Error>>
             <error::Error as From<bitcoincore_rpc_json::bitcoin::secp256k1::Error>>
             <error::Error as From<jsonrpc::Error>>
             <error::Error as From<serde_json::Error>>
             <error::Error as From<std::io::Error>>
   = note: required for `std::result::Result<T, error::Error>` to implement `FromResidual<std::result::Result<Infallible, OddLengthStringError>>`

error[E0277]: the trait bound `HexToBytesIter<bitcoincore_rpc_json::bitcoin::hex_conservative::iter::HexDigitsIter<'_>>: bitcoincore_rpc_json::bitcoin::bitcoin_io::BufRead` is not satisfied
   --> /Users/fedejinich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitcoincore-rpc-0.18.0/src/lib.rs:43:46
    |
43  |     let object = Decodable::consensus_decode(&mut reader)?;
    |                  --------------------------- ^^^^^^^^^^^ the trait `bitcoincore_rpc_json::bitcoin::bitcoin_io::BufRead` is not implemented for `HexToBytesIter<bitcoincore_rpc_json::bitcoin::hex_conservative::iter::HexDigitsIter<'_>>`
    |                  |
    |                  required by a bound introduced by this call
    |
    = help: the following other types implement trait `bitcoincore_rpc_json::bitcoin::bitcoin_io::BufRead`:
              &[u8]
              BufReader<R>
              bitcoincore_rpc_json::bitcoin::bitcoin_io::Cursor<T>
              bitcoincore_rpc_json::bitcoin::bitcoin_io::Take<'a, R>
note: required by a bound in `consensus_decode`
   --> /Users/fedejinich/.cargo/git/checkouts/rust-bitcoin-152ce3c54035dc85/48efda9/bitcoin/src/consensus/encode.rs:371:28
    |
371 |     fn consensus_decode<R: BufRead + ?Sized>(reader: &mut R) -> Result<Self, Error> {
    |                            ^^^^^^^ required by this bound in `Decodable::consensus_decode`

error[E0599]: the method `read_u8` exists for struct `HexToBytesIter<HexDigitsIter<'_>>`, but its trait bounds were not satisfied
  --> /Users/fedejinich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitcoincore-rpc-0.18.0/src/lib.rs:44:15
   |
44 |     if reader.read_u8().is_ok() {
   |               ^^^^^^^
   |
  ::: /Users/fedejinich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hex-conservative-0.2.0/src/iter.rs:20:1
   |
20 | pub struct HexToBytesIter<T: Iterator<Item = [u8; 2]>> {
   | ------------------------------------------------------ doesn't satisfy `_: ReadExt` or `_: Read`
   |
   = note: the following trait bounds were not satisfied:
           `HexToBytesIter<bitcoincore_rpc_json::bitcoin::hex_conservative::iter::HexDigitsIter<'_>>: bitcoincore_rpc_json::bitcoin::bitcoin_io::Read`
           which is required by `HexToBytesIter<bitcoincore_rpc_json::bitcoin::hex_conservative::iter::HexDigitsIter<'_>>: ReadExt`

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `bitcoincore-rpc` (lib) due to 3 previous errors

Have anyone had this error? Any idea on how to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions