Hide relative locktime error internals
As part of the 1.0 effort and forward maintainability hide the internals of the two error types in the `relative` locktime module. Doing so allows us to remove the `non_exhaustive` attribute. Add getters to get at the error innards.
This commit is contained in:
parent
e487618503
commit
2d8227f091
|
@ -401,12 +401,19 @@ impl std::error::Error for DisabledLockTimeError {}
|
||||||
|
|
||||||
/// Tried to satisfy a lock-by-blocktime lock using a height value.
|
/// Tried to satisfy a lock-by-blocktime lock using a height value.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
#[non_exhaustive]
|
|
||||||
pub struct IncompatibleHeightError {
|
pub struct IncompatibleHeightError {
|
||||||
/// Attempted to satisfy a lock-by-blocktime lock with this height.
|
/// Attempted to satisfy a lock-by-blocktime lock with this height.
|
||||||
pub height: Height,
|
height: Height,
|
||||||
/// The inner time value of the lock-by-blocktime lock.
|
/// The inner time value of the lock-by-blocktime lock.
|
||||||
pub time: Time,
|
time: Time,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IncompatibleHeightError {
|
||||||
|
/// Returns the height that was erroneously used to try and satisfy a lock-by-blocktime lock.
|
||||||
|
pub fn incompatible(&self) -> Height { self.height }
|
||||||
|
|
||||||
|
/// Returns the time value of the lock-by-blocktime lock.
|
||||||
|
pub fn expected(&self) -> Time { self.time }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for IncompatibleHeightError {
|
impl fmt::Display for IncompatibleHeightError {
|
||||||
|
@ -424,12 +431,19 @@ impl std::error::Error for IncompatibleHeightError {}
|
||||||
|
|
||||||
/// Tried to satisfy a lock-by-blockheight lock using a time value.
|
/// Tried to satisfy a lock-by-blockheight lock using a time value.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
#[non_exhaustive]
|
|
||||||
pub struct IncompatibleTimeError {
|
pub struct IncompatibleTimeError {
|
||||||
/// Attempted to satisfy a lock-by-blockheight lock with this time.
|
/// Attempted to satisfy a lock-by-blockheight lock with this time.
|
||||||
pub time: Time,
|
time: Time,
|
||||||
/// The inner height value of the lock-by-blockheight lock.
|
/// The inner height value of the lock-by-blockheight lock.
|
||||||
pub height: Height,
|
height: Height,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IncompatibleTimeError {
|
||||||
|
/// Returns the time that was erroneously used to try and satisfy a lock-by-blockheight lock.
|
||||||
|
pub fn incompatible(&self) -> Time { self.time }
|
||||||
|
|
||||||
|
/// Returns the height value of the lock-by-blockheight lock.
|
||||||
|
pub fn expected(&self) -> Height { self.height }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for IncompatibleTimeError {
|
impl fmt::Display for IncompatibleTimeError {
|
||||||
|
|
Loading…
Reference in New Issue