Skip to content

Commit

Permalink
Fix outstanding bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kixunil committed Jan 20, 2024
1 parent 5d75b16 commit b4bdc82
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo-minimal.lock
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ dependencies = [

[[package]]
name = "push_decode"
version = "0.4.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "704d18e38492fac1966cc154028b33512154b6eb0aa19412297c8a0d46007b1e"
checksum = "ace085aaf6d87413b78ccf0e629176e6f6b33019e740cd20400decb7bebc877e"
dependencies = [
"either",
]
Expand Down
4 changes: 2 additions & 2 deletions Cargo-recent.lock
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ dependencies = [

[[package]]
name = "push_decode"
version = "0.4.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "704d18e38492fac1966cc154028b33512154b6eb0aa19412297c8a0d46007b1e"
checksum = "ace085aaf6d87413b78ccf0e629176e6f6b33019e740cd20400decb7bebc877e"
dependencies = [
"either",
]
Expand Down
2 changes: 1 addition & 1 deletion bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
bech32 = { version = "0.10.0-beta", default-features = false, features = ["alloc"] }
consensus-encoding = { package = "bitcoin-consensus-encoding", path = "../consensus-encoding", features = ["hashes"] }
consensus-encoding = { package = "bitcoin-consensus-encoding", path = "../consensus-encoding", default-features = false, features = ["hashes"] }
hashes = { package = "bitcoin_hashes", version = "0.13.0", default-features = false, features = ["alloc", "io"] }
hex = { package = "hex-conservative", version = "0.1.1", default-features = false, features = ["alloc"] }
hex_lit = "0.1.1"
Expand Down
1 change: 1 addition & 0 deletions bitcoin/src/blockdata/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,7 @@ impl fmt::Display for TransactionDecodeError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for TransactionDecodeError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Expand Down
2 changes: 1 addition & 1 deletion consensus-encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ std = ["alloc", "push_decode/std"]
alloc = ["push_decode/alloc"]

[dependencies]
push_decode = { version = "0.4.1", default-features = false }
push_decode = { version = "0.4.2", default-features = false }
hashes = { package = "bitcoin_hashes", version = "0.13", optional = true, default-features = false }
internals = { package = "bitcoin-internals", version = "0.2.0", default-features = false }
9 changes: 8 additions & 1 deletion consensus-encoding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ ints!(u16, u32, u64, u128, i16, i32, i64, i128);

#[cfg(test)]
mod tests {
use super::{Decode, Encode};
use super::{Decode, Encode, impl_struct_decode, impl_struct_encode};
use core::fmt;

#[test]
fn impl_struct_de() {
Expand All @@ -87,6 +88,12 @@ mod tests {
}
}

impl fmt::Display for FooDecodeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "fee error")
}
}

let foo = Foo::consensus_decode_slice(&[0x2a, 0x00, 0x00, 0x00, 0x00, 0x40, 0x07, 0x5a, 0xf0, 0x75, 0x07, 0x00]).unwrap();
assert_eq!(foo.bar, 42);
assert_eq!(foo.baz, 2100000000000000);
Expand Down

0 comments on commit b4bdc82

Please sign in to comment.