locktime: add `FromHexStr` impl for `LockTime`
This will be tested in a later commit, when `PackedLockTime` is folded into this type so all its tests apply to `LockTime`.
This commit is contained in:
parent
74ff4946e4
commit
fa81568fb6
|
@ -423,6 +423,15 @@ impl fmt::Display for LockTime {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl FromHexStr for LockTime {
|
||||||
|
type Error = Error;
|
||||||
|
|
||||||
|
fn from_hex_str_no_prefix<S: AsRef<str> + Into<String>>(s: S) -> Result<Self, Self::Error> {
|
||||||
|
let packed_lock_time = crate::parse::hex_u32(s)?;
|
||||||
|
Ok(Self::from_consensus(packed_lock_time))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Encodable for LockTime {
|
impl Encodable for LockTime {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
|
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
|
||||||
|
|
Loading…
Reference in New Issue