Struct psbt::Output

source · []
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: u64

The output’s amount in satoshis.

script: Script

The 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

Returns whether this output may contain tapret commitment. This is detected by the presence of PSBT_OUT_TAPRET_HOST key.

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.

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.

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.

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.

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.

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Decode with the given std::io::Read instance; must either construct an instance or return implementation-specific error type. Read more

Tries to deserialize byte array into the current type using StrictDecode::strict_decode Read more

Encode with the given std::io::Write instance; must return result with either amount of bytes encoded – or implementation-specific error type. Read more

Serializes data as a byte array using StrictEncode::strict_encode function Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.