-
Notifications
You must be signed in to change notification settings - Fork 13
Description
While during parsing the values are in order (want, got):
Line 88 in bd9c2c7
| Err(HexToArrayError::InvalidLength(2 * $len, 2 * iter.len())) |
Display prints them in order (got, want):
Lines 124 to 134 in bd9c2c7
| impl fmt::Display for HexToArrayError { | |
| fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
| use HexToArrayError::*; | |
| match *self { | |
| Conversion(ref e) => crate::write_err!(f, "conversion error"; e), | |
| InvalidLength(got, want) => | |
| write!(f, "bad hex string length {} (expected {})", got, want), | |
| } | |
| } | |
| } |
This was, probably inadvertently, later fixed and v0.2.0 does not suffer from it anymore.
The issue is that rust-bitcoin v0.31.2 depends on hex-conservative v0.1.1 and therefore the error messages in v0.31.2 are incorrect. I know it's too tiny an issue, but if there is will to have this fixed (I can help), perhaps the solution would be to publish v0.1.2 with fix and let rust-bitcoin v0.31.3 depend on it?
Background: I am upgrading rust-lightning to rust-bitcoin v0.31 (see #2745) and it so happens that rust-lightning has a test which fails with v0.31 due to this issue. I have not yet opened PR on rust-lightning, may do so tomorrow.
failures:
---- convert::tests::into_txid_from_json_response_with_invalid_hex_data stdout ----
thread 'convert::tests::into_txid_from_json_response_with_invalid_hex_data' panicked at lightning-block-sync/src/convert.rs:610:17:
assertion `left == right` failed
left: "bad hex string length 64 (expected 6)"
right: "bad hex string length 6 (expected 64)"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- convert::tests::into_txid_from_json_response_with_invalid_txid_data stdout ----
thread 'convert::tests::into_txid_from_json_response_with_invalid_txid_data' panicked at lightning-block-sync/src/convert.rs:622:17:
assertion `left == right` failed
left: "bad hex string length 64 (expected 4)"
right: "bad hex string length 4 (expected 64)"
failures:
convert::tests::into_txid_from_json_response_with_invalid_hex_data
convert::tests::into_txid_from_json_response_with_invalid_txid_data