Struct Version
pub struct Version(/* private fields */);
Expand description
Bitcoin block version number.
Originally used as a protocol version, but repurposed for soft-fork signaling.
The inner value is a signed integer in Bitcoin Core for historical reasons, if version bits is being used the top three bits must be 001, this gives us a useful range of [0x20000000…0x3FFFFFFF].
When a block nVersion does not have top bits 001, it is treated as if all bits are 0 for the purposes of deployments.
§Relevant BIPs
Implementations§
§impl Version
impl Version
pub const NO_SOFT_FORK_SIGNALLING: Version = _
pub const NO_SOFT_FORK_SIGNALLING: Version = _
BIP-9 compatible version number that does not signal for any softforks.
pub const fn from_consensus(v: i32) -> Version
pub const fn from_consensus(v: i32) -> Version
Creates a Version
from a signed 32 bit integer value.
This is the data type used in consensus code in Bitcoin Core.
pub fn to_consensus(self) -> i32
pub fn to_consensus(self) -> i32
Returns the inner i32
value.
This is the data type used in consensus code in Bitcoin Core.
pub fn is_signalling_soft_fork(&self, bit: u8) -> bool
pub fn is_signalling_soft_fork(&self, bit: u8) -> bool
Checks whether the version number is signalling a soft fork at the given bit.
A block is signalling for a soft fork under BIP-9 if the first 3 bits are 001
and
the version bit for the specific soft fork is toggled on.
Trait Implementations§
§impl<'de> Deserialize<'de> for Version
impl<'de> Deserialize<'de> for Version
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Version, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Version, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Ord for Version
impl Ord for Version
§impl PartialOrd for Version
impl PartialOrd for Version
§impl Serialize for Version
impl Serialize for Version
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for Version
impl Eq for Version
impl StructuralPartialEq for Version
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request