mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Pass transaction source to validate_transaction (#5366)
* WiP * Support source in the runtime API. * Finish implementation in txpool. * Fix warning. * Fix tests. * Apply suggestions from code review Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-Authored-By: Nikolay Volf <nikvolf@gmail.com> * Extra changes. * Fix test and benches. * fix test * Fix test & benches again. * Fix tests. * Update bumpalo * Fix doc test. * Fix doctest. * Fix doctest. Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
@@ -161,6 +161,35 @@ impl Into<TransactionValidity> for UnknownTransaction {
|
||||
}
|
||||
}
|
||||
|
||||
/// The source of the transaction.
|
||||
///
|
||||
/// Depending on the source we might apply different validation schemes.
|
||||
/// For instance we can disallow specific kinds of transactions if they were not produced
|
||||
/// by our local node (for instance off-chain workers).
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, parity_util_mem::MallocSizeOf)]
|
||||
pub enum TransactionSource {
|
||||
/// Transaction is already included in block.
|
||||
///
|
||||
/// This means that we can't really tell where the transaction is coming from,
|
||||
/// since it's already in the received block. Note that the custom validation logic
|
||||
/// using either `Local` or `External` should most likely just allow `InBlock`
|
||||
/// transactions as well.
|
||||
InBlock,
|
||||
|
||||
/// Transaction is coming from a local source.
|
||||
///
|
||||
/// This means that the transaction was produced internally by the node
|
||||
/// (for instance an Off-Chain Worker, or an Off-Chain Call), as opposed
|
||||
/// to being received over the network.
|
||||
Local,
|
||||
|
||||
/// Transaction has been received externally.
|
||||
///
|
||||
/// This means the transaction has been received from (usually) "untrusted" source,
|
||||
/// for instance received over the network or RPC.
|
||||
External,
|
||||
}
|
||||
|
||||
/// Information concerning a valid transaction.
|
||||
#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)]
|
||||
pub struct ValidTransaction {
|
||||
|
||||
Reference in New Issue
Block a user