Skip to content

Commit 0e86cfe

Browse files
committed
chore: improve comments around OnchainTransactionUnconfirmed
1 parent a39bb6b commit 0e86cfe

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/event.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,19 @@ pub enum Event {
466466
},
467467
/// An onchain transaction became unconfirmed.
468468
///
469-
/// This can happen after a chain reorganization where a previously confirmed transaction
470-
/// is no longer in the best chain. Applications should handle this by marking the
471-
/// transaction as pending again.
469+
/// This event is emitted in two scenarios:
470+
/// 1. **Chain Reorg**: A previously confirmed transaction is no longer
471+
/// in the best chain due to a reorg.
472+
/// 2. **Replace-By-Fee (RBF)**: A transaction was replaced by another transaction.
473+
///
474+
/// **Note**: This event does NOT cover all cases of transaction removal from the mempool.
475+
/// Specifically, it will NOT be emitted when:
476+
/// - A transaction is dropped from the mempool due to expiration
477+
/// - A transaction is evicted due to low fees when the mempool is full
478+
/// - A transaction is simply "forgotten" by nodes without replacement
479+
///
480+
/// Applications should handle this event by marking the transaction as pending again
481+
/// and potentially taking action (e.g., updating UI, re-evaluating fee requirements).
472482
///
473483
/// # Example
474484
///
@@ -484,7 +494,7 @@ pub enum Event {
484494
/// node.sync_wallets().unwrap();
485495
///
486496
/// if let Some(Event::OnchainTransactionUnconfirmed { txid }) = node.next_event() {
487-
/// println!("Transaction {} is now unconfirmed due to reorg", txid);
497+
/// println!("Transaction {} is now unconfirmed due to a reorg or RBF", txid);
488498
/// node.event_handled().unwrap();
489499
/// }
490500
/// ```

0 commit comments

Comments
 (0)