Merge rust-bitcoin/rust-bitcoin#2667: Remove deprecated legacy numeric methods
051c358bcb
Remove deprecated legacy numeric methods (Divyansh Gupta) Pull request description: As `rustc 1.79.0-nightly (9d79cd5f7 2024-04-05)` is released which solves the issue mentioned , but the release has deperacted legacy numeric methods. Thus replaced `u16::max_value()` etc with `u32::MAX` & `core::u16` to directly `u16`. fix #2639 ACKs for top commit: tcharding: ACK051c358bcb
apoelstra: ACK051c358bcb
thanks! I will remove an equivalent commit from my #2669 Tree-SHA512: c08c856f7f3b281417c29283351eac5e0f75cc1c8d23d9aae58d969219a327b2337fe57932053e53773ebb9dbec04254f90149266b6639a66c5c09f2ad1675ef
This commit is contained in:
commit
5c56b69eed
|
@ -492,7 +492,7 @@ mod test {
|
||||||
fn test_getblocktx_panic_when_encoding_u64_max() {
|
fn test_getblocktx_panic_when_encoding_u64_max() {
|
||||||
serialize(&BlockTransactionsRequest {
|
serialize(&BlockTransactionsRequest {
|
||||||
block_hash: Hash::all_zeros(),
|
block_hash: Hash::all_zeros(),
|
||||||
indexes: vec![core::u64::MAX],
|
indexes: vec![u64::MAX],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
//! typically big-endian decimals, etc.)
|
//! typically big-endian decimals, etc.)
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use core::{fmt, mem, u32};
|
use core::{fmt, mem};
|
||||||
|
|
||||||
use hashes::{sha256, sha256d, Hash};
|
use hashes::{sha256, sha256d, Hash};
|
||||||
use hex::error::{InvalidCharError, OddLengthStringError};
|
use hex::error::{InvalidCharError, OddLengthStringError};
|
||||||
|
|
|
@ -212,7 +212,7 @@ impl<T: AsRef<[u8]>> Read for Cursor<T> {
|
||||||
let read = core::cmp::min(inner.len().saturating_sub(start_pos), buf.len());
|
let read = core::cmp::min(inner.len().saturating_sub(start_pos), buf.len());
|
||||||
buf[..read].copy_from_slice(&inner[start_pos..start_pos + read]);
|
buf[..read].copy_from_slice(&inner[start_pos..start_pos + read]);
|
||||||
self.pos =
|
self.pos =
|
||||||
self.pos.saturating_add(read.try_into().unwrap_or(u64::max_value() /* unreachable */));
|
self.pos.saturating_add(read.try_into().unwrap_or(u64::MAX /* unreachable */));
|
||||||
Ok(read)
|
Ok(read)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ impl Time {
|
||||||
pub const MIN: Self = Time(LOCK_TIME_THRESHOLD);
|
pub const MIN: Self = Time(LOCK_TIME_THRESHOLD);
|
||||||
|
|
||||||
/// The maximum absolute block time (Sun Feb 07 2106 06:28:15 GMT+0000).
|
/// The maximum absolute block time (Sun Feb 07 2106 06:28:15 GMT+0000).
|
||||||
pub const MAX: Self = Time(u32::max_value());
|
pub const MAX: Self = Time(u32::MAX);
|
||||||
|
|
||||||
/// Creates a `Time` from a hex string.
|
/// Creates a `Time` from a hex string.
|
||||||
///
|
///
|
||||||
|
|
|
@ -20,7 +20,7 @@ impl Height {
|
||||||
pub const MIN: Self = Self::ZERO;
|
pub const MIN: Self = Self::ZERO;
|
||||||
|
|
||||||
/// The maximum relative block height.
|
/// The maximum relative block height.
|
||||||
pub const MAX: Self = Height(u16::max_value());
|
pub const MAX: Self = Height(u16::MAX);
|
||||||
|
|
||||||
/// Create a [`Height`] using a count of blocks.
|
/// Create a [`Height`] using a count of blocks.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -62,7 +62,7 @@ impl Time {
|
||||||
pub const MIN: Self = Time::ZERO;
|
pub const MIN: Self = Time::ZERO;
|
||||||
|
|
||||||
/// The maximum relative block time (33,554,432 seconds or approx 388 days).
|
/// The maximum relative block time (33,554,432 seconds or approx 388 days).
|
||||||
pub const MAX: Self = Time(u16::max_value());
|
pub const MAX: Self = Time(u16::MAX);
|
||||||
|
|
||||||
/// Create a [`Time`] using time intervals where each interval is equivalent to 512 seconds.
|
/// Create a [`Time`] using time intervals where each interval is equivalent to 512 seconds.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue