Skip to content

Commit

Permalink
update bitcoin to 0.31.1
Browse files Browse the repository at this point in the history
  • Loading branch information
getong committed Jan 27, 2024
1 parent 24e4ca2 commit 73ba207
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ path = "src/lib.rs"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
bitcoin = { version = "0.30.0", features = ["serde", "std"], default-features = false }
bitcoin = { version = "0.31.1", features = ["serde", "std"], default-features = false }
# Temporary dependency on internals until the rust-bitcoin devs release the hex-conservative crate.
bitcoin-internals = { version = "0.1.0", features = ["alloc"] }
bitcoin-internals = { version = "0.2.0", features = ["alloc"] }
log = "^0.4"
ureq = { version = "2.5.0", features = ["json"], optional = true }
ureq = { version = "2.9.1", features = ["json"], optional = true }
reqwest = { version = "0.11", optional = true, default-features = false, features = ["json"] }
hex-conservative = "0.1.1"

[dev-dependencies]
serde_json = "1.0"
tokio = { version = "1.20.1", features = ["full"] }
electrsd = { version = "0.24.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_22_0"] }
electrum-client = "0.16.0"
tokio = { version = "1.35.1", features = ["full"] }
electrsd = { version = "0.27.1", features = ["legacy", "esplora_a33e97e1", "bitcoind_25_0"] }
electrum-client = "0.19.0"
lazy_static = "1.4.0"

[features]
Expand Down
8 changes: 4 additions & 4 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
pub use bitcoin::consensus::{deserialize, serialize};
pub use bitcoin::hashes::hex::FromHex;
use bitcoin::{blockdata::transaction::Version, Amount};
pub use bitcoin::{BlockHash, OutPoint, ScriptBuf, Transaction, TxIn, TxOut, Txid, Witness};

use serde::Deserialize;

#[derive(Deserialize, Clone, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -93,7 +93,7 @@ pub struct BlockSummary {
impl Tx {
pub fn to_tx(&self) -> Transaction {
Transaction {
version: self.version,
version: Version(self.version),
lock_time: bitcoin::absolute::LockTime::from_consensus(self.locktime),
input: self
.vin
Expand All @@ -114,7 +114,7 @@ impl Tx {
.iter()
.cloned()
.map(|vout| TxOut {
value: vout.value,
value: Amount::from_int_btc(vout.value),
script_pubkey: vout.scriptpubkey,
})
.collect(),
Expand All @@ -140,7 +140,7 @@ impl Tx {
.map(|vin| {
vin.prevout.map(|po| TxOut {
script_pubkey: po.scriptpubkey,
value: po.value,
value: Amount::from_int_btc(po.value),
})
})
.collect()
Expand Down
11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use std::fmt;
use std::io;

use bitcoin::consensus;

use hex_conservative::{HexToArrayError, HexToBytesError};
pub mod api;

#[cfg(feature = "async")]
Expand Down Expand Up @@ -171,8 +171,10 @@ pub enum Error {
Parsing(std::num::ParseIntError),
/// Invalid Bitcoin data returned
BitcoinEncoding(bitcoin::consensus::encode::Error),
/// Invalid Hex data returned
Hex(bitcoin::hashes::hex::Error),
/// Invalid Hex Array returned
HexArray(HexToArrayError),
/// Invalid Hex Bytes returned
HexBytes(HexToBytesError),

/// Transaction not found
TransactionNotFound(Txid),
Expand Down Expand Up @@ -209,7 +211,8 @@ impl_error!(::reqwest::Error, Reqwest, Error);
impl_error!(io::Error, Io, Error);
impl_error!(std::num::ParseIntError, Parsing, Error);
impl_error!(consensus::encode::Error, BitcoinEncoding, Error);
impl_error!(bitcoin::hashes::hex::Error, Hex, Error);
impl_error!(HexToArrayError, HexArray, Error);
impl_error!(HexToBytesError, HexBytes, Error);

#[cfg(test)]
mod test {
Expand Down

0 comments on commit 73ba207

Please sign in to comment.