pub struct Global { /* private fields */ }Expand description
Global fields that are relevant to the transaction as a whole.
Implementations§
Source§impl Global
impl Global
pub fn tx_version(&self) -> &u32
pub fn version_group_id(&self) -> &u32
Sourcepub fn consensus_branch_id(&self) -> &u32
pub fn consensus_branch_id(&self) -> &u32
The consensus branch ID for the chain in which this transaction will be mined.
Non-optional because this commits to the set of consensus rules that will apply to the transaction; differences therein can affect every role.
Sourcepub fn fallback_lock_time(&self) -> &Option<u32>
pub fn fallback_lock_time(&self) -> &Option<u32>
The transaction locktime to use if no inputs specify a required locktime.
- This is set by the Creator.
- If omitted, the fallback locktime is assumed to be 0.
The transaction’s actual lock time is given by determine_lock_time, which
takes the inputs’ required lock times into account.
pub fn expiry_height(&self) -> &u32
Sourcepub fn coin_type(&self) -> &u32
pub fn coin_type(&self) -> &u32
The SLIP 44 coin type, indicating the network for which this transaction is being constructed.
This is technically information that could be determined indirectly from the
consensus_branch_id but is included explicitly to enable easy identification.
Note that this field is not included in the transaction and has no consensus
effect (consensus_branch_id fills that role).
- This is set by the Creator.
- Roles that encode network-specific information (for example, derivation paths for key identification) should check against this field for correctness.
Sourcepub fn tx_modifiable(&self) -> &u8
pub fn tx_modifiable(&self) -> &u8
A bitfield for various transaction modification flags.
- Bit 0 is the Transparent Inputs Modifiable Flag and indicates whether
transparent inputs can be modified.
- This is set to
trueby the Creator. - This is checked by the Constructor before adding transparent inputs, and may
be set to
falseby the Constructor. - This is set to
falseby the IO Finalizer if there are shielded spends or outputs. - This is set to
falseby a Signer that adds a signature that does not useSIGHASH_ANYONECANPAY(which includes all shielded signatures). - The Combiner merges this bit towards
false.
- This is set to
- Bit 1 is the Transparent Outputs Modifiable Flag and indicates whether
transparent outputs can be modified.
- This is set to
trueby the Creator. - This is checked by the Constructor before adding transparent outputs, and may
be set to
falseby the Constructor. - This is set to
falseby the IO Finalizer if there are shielded spends or outputs. - This is set to
falseby a Signer that adds a signature that does not useSIGHASH_NONE(which includes all shielded signatures). - The Combiner merges this bit towards
false.
- This is set to
- Bit 2 is the Has
SIGHASH_SINGLEFlag and indicates whether the transaction has aSIGHASH_SINGLEtransparent signature who’s input and output pairing must be preserved.- This is set to
falseby the Creator. - This is updated by a Constructor.
- This is set to
trueby a Signer that adds a signature that usesSIGHASH_SINGLE. - This essentially indicates that the Constructor must iterate the transparent inputs to determine whether and how to add a transparent input.
- The Combiner merges this bit towards
true.
- This is set to
- Bits 3-6 must be 0.
- Bit 7 is the Shielded Modifiable Flag and indicates whether shielded spends or
outputs can be modified.
- This is set to
trueby the Creator. - This is checked by the Constructor before adding shielded spends or outputs,
and may be set to
falseby the Constructor. - This is set to
falseby the IO Finalizer if there are shielded spends or outputs. - This is set to
falseby every Signer (as all signatures commit to all shielded spends and outputs). - The Combiner merges this bit towards
false.
- This is set to
Individual flags are also available via Global::inputs_modifiable,
Global::outputs_modifiable, Global::has_sighash_single, and
Global::shielded_modifiable.
Source§impl Global
impl Global
Sourcepub fn inputs_modifiable(&self) -> bool
pub fn inputs_modifiable(&self) -> bool
Returns whether transparent inputs can be added to or removed from the transaction.
Sourcepub fn outputs_modifiable(&self) -> bool
pub fn outputs_modifiable(&self) -> bool
Returns whether transparent outputs can be added to or removed from the transaction.
Sourcepub fn has_sighash_single(&self) -> bool
pub fn has_sighash_single(&self) -> bool
Returns whether the transaction has a SIGHASH_SINGLE transparent signature who’s
input and output pairing must be preserved.
Sourcepub fn shielded_modifiable(&self) -> bool
pub fn shielded_modifiable(&self) -> bool
Returns whether shielded spends or outputs can be added to or removed from the transaction.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Global
impl<'de> Deserialize<'de> for Global
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Global
impl RefUnwindSafe for Global
impl Send for Global
impl Sync for Global
impl Unpin for Global
impl UnsafeUnpin for Global
impl UnwindSafe for Global
Blanket Implementations§
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<T> Conv for T
impl<T> Conv for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.