pub struct Output {
pub amount: u64,
pub script: Script,
pub redeem_script: Option<Script>,
pub witness_script: Option<Script>,
pub bip32_derivation: BTreeMap<PublicKey, KeySource>,
pub tap_internal_key: Option<XOnlyPublicKey>,
pub tap_tree: Option<TapTree>,
pub tap_key_origins: BTreeMap<XOnlyPublicKey, (Vec<TapLeafHash>, KeySource)>,
pub proprietary: BTreeMap<ProprietaryKey, Vec<u8>>,
pub unknown: BTreeMap<Key, Vec<u8>>,
/* private fields */
}Fields
amount: u64The output’s amount in satoshis.
script: ScriptThe script for this output, also known as the scriptPubKey.
redeem_script: Option<Script>The redeem script for this output.
witness_script: Option<Script>The witness script for this output.
bip32_derivation: BTreeMap<PublicKey, KeySource>A map from public keys needed to spend this output to their corresponding master key fingerprints and derivation paths.
tap_internal_key: Option<XOnlyPublicKey>The internal pubkey.
tap_tree: Option<TapTree>Taproot Output tree.
tap_key_origins: BTreeMap<XOnlyPublicKey, (Vec<TapLeafHash>, KeySource)>Map of tap root x only keys to origin info and leaf hashes contained in it.
proprietary: BTreeMap<ProprietaryKey, Vec<u8>>Proprietary key-value pairs for this output.
unknown: BTreeMap<Key, Vec<u8>>Unknown key-value pairs for this output.
Implementations
sourceimpl Output
impl Output
sourcepub fn can_host_tapret(&self) -> bool
pub fn can_host_tapret(&self) -> bool
Returns whether this output may contain tapret commitment. This is
detected by the presence of PSBT_OUT_TAPRET_HOST key.
sourcepub fn tapret_dfs_path(&self) -> Option<Result<DfsPath, DfsPathEncodeError>>
pub fn tapret_dfs_path(&self) -> Option<Result<DfsPath, DfsPathEncodeError>>
Returns information on the specific path within taproot script tree
which is allowed as a place for tapret commitment. The path is taken
from PSBT_OUT_TAPRET_HOST key.
Returns
A value of the PSBT_OUT_TAPRET_HOST key, if present, or None
otherwise. The value is deserialized from the key value data, and if
the serialization fails a Some(Err(DfsPathEncodeError)) is
returned.
sourcepub fn set_tapret_dfs_path(&mut self, path: &DfsPath)
pub fn set_tapret_dfs_path(&mut self, path: &DfsPath)
Sets information on the specific path within taproot script tree which
is allowed as a place for tapret commitment. The path is put into
PSBT_OUT_TAPRET_HOST key.
sourcepub fn has_tapret_commitment(&self) -> bool
pub fn has_tapret_commitment(&self) -> bool
Detects presence of a vaid PSBT_OUT_TAPRET_COMMITMENT.
If PSBT_OUT_TAPRET_COMMITMENT is absent or its value is invalid,
returns false. In the future, when PSBT_OUT_TAPRET_COMMITMENT will
become a standard and non-custom key, PSBTs with invalid key values
will error at deserialization and this function will return false
only in cases when the output does not have
PSBT_OUT_TAPRET_COMMITMENT.
sourcepub fn tapret_commitment(&self) -> Option<Slice32>
pub fn tapret_commitment(&self) -> Option<Slice32>
Returns valid tapret commitment from the PSBT_OUT_TAPRET_COMMITMENT
key, if present. If the commitment is absent or invalid, returns
None.
We do not error on invalid commitments in order to support future update
of this proprietary key to the standard one. In this case, the
invalid commitments (having non-32 bytes) will be filtered at the
moment of PSBT deserialization and this function will return None
only in situations when the commitment is absent.
sourcepub fn set_tapret_commitment(
&mut self,
commitment: impl Into<[u8; 32]>
) -> Result<(), KeyError>
pub fn set_tapret_commitment(
&mut self,
commitment: impl Into<[u8; 32]>
) -> Result<(), KeyError>
Assigns value of the tapreturn commitment to this PSBT output, by
adding PSBT_OUT_TAPRET_COMMITMENT proprietary key containing the
32-byte commitment as its value.
Errors with KeyError::OutputAlreadyHasCommitment if the commitment
is already present in the output.
sourcepub fn has_tapret_proof(&self) -> bool
pub fn has_tapret_proof(&self) -> bool
Detects presence of a valid PSBT_OUT_TAPRET_PROOF.
If PSBT_OUT_TAPRET_PROOF is absent or its value is invalid,
returns false. In the future, when PSBT_OUT_TAPRET_PROOF will
become a standard and non-custom key, PSBTs with invalid key values
will error at deserialization and this function will return false
only in cases when the output does not have PSBT_OUT_TAPRET_PROOF.
sourcepub fn tapret_proof(&self) -> Option<TaprootMerkleBranch>
pub fn tapret_proof(&self) -> Option<TaprootMerkleBranch>
Returns valid tapret commitment proof from the PSBT_OUT_TAPRET_PROOF
key, if present. If the commitment is absent or invalid, returns None.
We do not error on invalid proofs in order to support future update of
this proprietary key to the standard one. In this case, the invalid
commitments (having non-32 bytes) will be filtered at the moment of PSBT
deserialization and this function will return None only in situations
when the commitment is absent.
Trait Implementations
sourceimpl StrictDecode for Output
impl StrictDecode for Output
sourcefn strict_decode<D: Read>(d: D) -> Result<Self, Error>
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
Decode with the given std::io::Read instance; must either
construct an instance or return implementation-specific error type. Read more
sourcefn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
StrictDecode::strict_decode Read more
sourceimpl StrictEncode for Output
impl StrictEncode for Output
sourcefn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
Encode with the given std::io::Write instance; must return result
with either amount of bytes encoded – or implementation-specific
error type. Read more
sourcefn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
Serializes data as a byte array using StrictEncode::strict_encode
function Read more
impl Eq for Output
impl StructuralEq for Output
impl StructuralPartialEq for Output
Auto Trait Implementations
impl RefUnwindSafe for Output
impl Send for Output
impl Sync for Output
impl Unpin for Output
impl UnwindSafe for Output
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more