Merge rust-bitcoin/rust-bitcoin#4381: Make Version::maybe_non_standard and Version::is_standard const
6370aac7e1
Make Version::maybe_non_standard and Version::is_standard const (Shing Him Ng)
Pull request description:
Closes #4206
ACKs for top commit:
apoelstra:
ACK 6370aac7e119042d8b6b40021bbcd6324ad02bbb; successfully ran local tests
Tree-SHA512: aaf6afbe39d6568e0d05776a2a2f58a9a657f28cd3942391b599390bb4db974684e7d76cdf8db51a0fbcb948cdc4e19f22ba4b8ca39537e162cbd5bb2d4cd40e
This commit is contained in:
commit
39f5075708
|
@ -564,7 +564,7 @@ impl Version {
|
|||
///
|
||||
/// This can accept both standard and non-standard versions.
|
||||
#[inline]
|
||||
pub fn maybe_non_standard(version: u32) -> Version { Self(version) }
|
||||
pub const fn maybe_non_standard(version: u32) -> Version { Self(version) }
|
||||
|
||||
/// Returns the inner `u32` value of this `Version`.
|
||||
#[inline]
|
||||
|
@ -577,8 +577,8 @@ impl Version {
|
|||
/// As of Bitcoin Core 28.0 ([release notes](https://bitcoincore.org/en/releases/28.0/)),
|
||||
/// versions 1, 2, and 3 are considered standard.
|
||||
#[inline]
|
||||
pub fn is_standard(self) -> bool {
|
||||
self == Version::ONE || self == Version::TWO || self == Version::THREE
|
||||
pub const fn is_standard(self) -> bool {
|
||||
self.0 == Version::ONE.0 || self.0 == Version::TWO.0 || self.0 == Version::THREE.0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue