Transaction checks rearranged so no check is wasted
Now all cheap checks are performed first, prior to potentially lengthy operation validation and very costly authorization checks.
Current check order:
- duplication - no point in performing any other check when we already know the transaction.
- expiration - expired transactions are generally dropped early (in pending or block production loop), so only occasionally we might get expired one from p2p or API
- tapos - incorrect tapos means transaction targets different fork, so no point in any other checks
- operation validation - this check can be lengthy when transaction has many operations or those ops are custom_json (parsing json is most expensive among operation checks)
- signature verification - most expensive of checks, even if there is only one signature