Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Commit 877e193

Browse files
authored
Remove rename for finalized event and add some docs. (#4930)
* Remove rename for finalized event. * ADd some docs. * Document timeout.
1 parent b27d50c commit 877e193

File tree

1 file changed

+15
-3
lines changed
  • primitives/transaction-pool/src

1 file changed

+15
-3
lines changed

primitives/transaction-pool/src/pool.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,22 @@ impl PoolStatus {
6767
/// 2. Inside `Ready` queue:
6868
/// - `Broadcast`
6969
/// 3. Leaving the pool:
70-
/// - `Finalized`
70+
/// - `InBlock`
7171
/// - `Invalid`
7272
/// - `Usurped`
7373
/// - `Dropped`
74+
/// 4. Re-entering the pool:
75+
/// - `Retracted`
76+
/// 5. Block finalized:
77+
/// - `Finalized`
78+
/// - `FinalityTimeout`
7479
///
7580
/// The events will always be received in the order described above, however
7681
/// there might be cases where transactions alternate between `Future` and `Ready`
7782
/// pool, and are `Broadcast` in the meantime.
7883
///
7984
/// There is also only single event causing the transaction to leave the pool.
85+
/// I.e. only one of the listed ones should be triggered.
8086
///
8187
/// Note that there are conditions that may cause transactions to reappear in the pool.
8288
/// 1. Due to possible forks, the transaction that ends up being in included
@@ -86,8 +92,15 @@ impl PoolStatus {
8692
/// 3. `Invalid` transaction may become valid at some point in the future.
8793
/// (Note that runtimes are encouraged to use `UnknownValidity` to inform the pool about
8894
/// such case).
95+
/// 4. `Retracted` transactions might be included in some next block.
8996
///
90-
/// However the user needs to re-subscribe to receive such notifications.
97+
/// The stream is considered finished only when either `Finalized` or `FinalityTimeout`
98+
/// event is triggered. You are however free to unsubscribe from notifications at any point.
99+
/// The first one will be emitted when the block, in which transaction was included gets
100+
/// finalized. The `FinalityTimeout` event will be emitted when the block did not reach finality
101+
/// within 512 blocks. This either indicates that finality is not available for your chain,
102+
/// or that finality gadget is lagging behind. If you choose to wait for finality longer, you can
103+
/// re-subscribe for a particular transaction hash manually again.
91104
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
92105
#[serde(rename_all = "camelCase")]
93106
pub enum TransactionStatus<Hash, BlockHash> {
@@ -98,7 +111,6 @@ pub enum TransactionStatus<Hash, BlockHash> {
98111
/// The transaction has been broadcast to the given peers.
99112
Broadcast(Vec<String>),
100113
/// Transaction has been included in block with given hash.
101-
#[serde(rename = "finalized")] // See #4438
102114
InBlock(BlockHash),
103115
/// The block this transaction was included in has been retracted.
104116
Retracted(BlockHash),

0 commit comments

Comments
 (0)