If I submit a transaction via "author_submitAndWatchExtrinsic", I start getting back TransactionStatus updates, which look like one of these:
pub enum TransactionStatus<Hash, BlockHash> {
/// Transaction is part of the future queue.
Future,
/// Transaction is part of the ready queue.
Ready,
/// The transaction has been broadcast to the given peers.
Broadcast(Vec<String>),
/// Transaction has been included in block with given hash
/// at the given position.
#[serde(with = "v1_compatible")]
InBlock((BlockHash, TxIndex)),
/// The block this transaction was included in has been retracted.
Retracted(BlockHash),
/// Maximum number of finality watchers has been reached,
/// old watchers are being removed.
FinalityTimeout(BlockHash),
/// Transaction has been finalized by a finality-gadget, e.g GRANDPA.
#[serde(with = "v1_compatible")]
Finalized((BlockHash, TxIndex)),
/// Transaction has been replaced in the pool, by another transaction
/// that provides the same tags. (e.g. same (sender, nonce)).
Usurped(Hash),
/// Transaction has been dropped from the pool because of the limit.
Dropped,
/// Transaction is no longer valid in the current state.
Invalid,
}
The docs above this enum state:
/// The stream is considered finished only when either `Finalized` or `FinalityTimeout`
/// event is triggered. You are however free to unsubscribe from notifications at any point.
So my questions are:
- Will I always eventually receive either a
Finalized
orFinalityTimeout
notification for some transaction I submit (even if it becomesInvalid
, say)? - If the answer is "no" to the above: Would I be right to assume that the last
TransactionStatus
received before the stream is dropped is indicative of what happened to the transaction (ie perhaps it becameInvalid
or whatever). - If I set a fixed mortality on some transaction, will it lead to the subscription being ended sooner (either with
Finalized
orFinalityTimeout
or perhaps just withInvalid
)?
Ultimately, I am asking these with this Subxt logic in mind, and want to see if there is any way to improve it: https://github.com/paritytech/subxt/blob/42bcddeecb39db98e711075b44331d24a8fbeb4d/subxt/src/tx/tx_progress.rs#L102