Enum bp::short_id::Descriptor

source ·
pub enum Descriptor {
    OnchainBlock {
        block_height: u32,
        block_checksum: BlockChecksum,
    },
    OnchainTransaction {
        block_height: u32,
        block_checksum: BlockChecksum,
        tx_index: u16,
    },
    OnchainTxInput {
        block_height: u32,
        block_checksum: BlockChecksum,
        tx_index: u16,
        input_index: u16,
    },
    OnchainTxOutput {
        block_height: u32,
        block_checksum: BlockChecksum,
        tx_index: u16,
        output_index: u16,
    },
    OffchainTransaction {
        tx_checksum: TxChecksum,
    },
    OffchainTxInput {
        tx_checksum: TxChecksum,
        input_index: u16,
    },
    OffchainTxOutput {
        tx_checksum: TxChecksum,
        output_index: u16,
    },
}
Expand description

Descriptor enum defines the onchain/offchain entity type

Variants

OnchainBlock

Fields

block_height: u32

Height of onchain block

block_checksum: BlockChecksum

Checksum of onchain block

Block included onchain

OnchainTransaction

Fields

block_height: u32

Height of the block tx belongs to

block_checksum: BlockChecksum

Checksum of the block tx belongs to

tx_index: u16

Index in the block tx belongs to

Tx included onchain

OnchainTxInput

Fields

block_height: u32

Height of the block the tx input belongs to

block_checksum: BlockChecksum

Checksum of the block the tx input belongs to

tx_index: u16

Index in the block tx belongs to

input_index: u16

Index in the tx the input belongs to

Tx input included onchain

OnchainTxOutput

Fields

block_height: u32

Height of the block the tx input belongs to

block_checksum: BlockChecksum

Checksum of the block the tx input belongs to

tx_index: u16

Index in the block tx belongs to

output_index: u16

Index in the tx the output belongs to

Tx output included onchain

OffchainTransaction

Fields

tx_checksum: TxChecksum

Offchain tx checksum

Tx not included onchain

OffchainTxInput

Fields

tx_checksum: TxChecksum

Offchain tx checksum

input_index: u16

Index in the tx the input belongs to

Tx input not included onchain

OffchainTxOutput

Fields

tx_checksum: TxChecksum

Offchain tx checksum

output_index: u16

Index in the tx the output belongs to

Tx output not included onchain

Implementations

Verifies if Descriptor type has valid properties otherwise returns validation error

Returns true if Descriptor type is either OnchainBlock or OnchainTransaction or OnchainTxInput or OnchainTxOutput

Returns true if Descriptor type is not onchain type

Upgraded returns the “wrapped descriptor” based on provided parameters. for instance, tx is returned in case descriptor is a block, as well as input/out is returned in case descriptor is a tx and dimension is specified

Downgraded returns the “wrapper descriptor”, i.e. in case the descriptor is an onchain tx, the onchain block is returned, as well as the onchain tx is returned for onchain input/output

Get block height extracting from Descriptor

Get block checksum extracting from Descriptor

Get tx checksum extracting from Descriptor

Get tx index extracting from Descriptor

Get input index extracting from Descriptor

Get output index extracting from Descriptor

Tries to convert short id from Descriptor to u64

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.
The type returned in the event of a conversion error.
Performs the conversion.

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
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.