Trait frame_support::pallet_prelude::ValidateUnsigned [−][src]
pub trait ValidateUnsigned { type Call; fn validate_unsigned(
source: TransactionSource,
call: &Self::Call
) -> Result<ValidTransaction, TransactionValidityError>; fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError> { ... } }
Expand description
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
Required methods
fn validate_unsigned(
source: TransactionSource,
call: &Self::Call
) -> Result<ValidTransaction, TransactionValidityError>
fn validate_unsigned(
source: TransactionSource,
call: &Self::Call
) -> Result<ValidTransaction, TransactionValidityError>
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.
Provided methods
fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError>
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
.