1

how do i check a transaction before it gets added to the transaction pool, kind of like BlockImport but for transactions that are coming from outside(from other validators or clients)?

1 Answer 1

3

Every transaction is passed to the validate_transaction function in your runtime, before it enters the pool. This ensures that the transaction is valid and also gives back information about how longevity and priority of the transaction.

2
  • is to possible to have an off-chain worker inside that function (because i want to call a grpc server from there, fetch something offchain)
    – dadzerlaze
    Commented Nov 15, 2022 at 13:56
  • 1
    Theoretically yes, but that would make this check very expensive. But this check should be as cheap as possible, as otherwise nodes can start spamming you with transactions and making your node do expensive operations for free.
    – bkchr
    Commented Nov 15, 2022 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.