[][src]Trait sp_runtime::traits::ValidateUnsigned

pub trait ValidateUnsigned {
    type Call;
    fn validate_unsigned(
        source: TransactionSource,
        call: &Self::Call
    ) -> TransactionValidity; fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError> { ... } }

Something that can validate unsigned extrinsics for the transaction pool.

Note that any checks done here are only used for determining the validity of the transaction for the transaction pool. During block execution phase one need to perform the same checks anyway, since this function is not being called.

Associated Types

type Call

The call to validate

Loading content...

Required methods

fn validate_unsigned(
    source: TransactionSource,
    call: &Self::Call
) -> TransactionValidity

Return the validity of the call

This doesn't execute any side-effects; it merely checks whether the transaction would panic if it were included or not.

Changes made to storage should be discarded by caller.

Loading content...

Provided methods

fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError>

Validate the call right before dispatch.

This method should be used to prevent transactions already in the pool (i.e. passing validate_unsigned) from being included in blocks in case we know they now became invalid.

By default it's a good idea to call validate_unsigned from within this function again to make sure we never include an invalid transaction.

Changes made to storage WILL be persisted if the call returns Ok.

Loading content...

Implementors

Loading content...