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.