Skip to content

Commit 25c8b37

Browse files
committed
WIP: IntentTracker requirements
1 parent bcb4938 commit 25c8b37

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

wallet/examples/intent_tracker.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ where
3030
Ok(())
3131
}
3232

33+
/// Demonstate how we handle the following situations:
34+
///
35+
/// ## An outgoing transaction depends on an incoming transaction that gets replaced.
36+
///
37+
/// Given:
38+
/// * Wallet receives an incoming unconfirmed transaction.
39+
/// * Wallet creates outgoing transaction that spends from the incoming transaction.
40+
/// * The wallet tracks the outgoing transaction (with `wallet.track_tx`).
41+
/// * The incoming transaction gets replaced.
42+
///
43+
/// When:
44+
/// * `wallet.uncanonical_txs` is called, expect:
45+
/// * 1 transaction is returned (the created outgoing transaction).
46+
/// * `UncanonicalTx::is_safe_to_untrack(0)` should return true.
47+
/// * `UncanonicalTx::is_safe_to_untrack(>0)` should return false.
48+
/// * TODO: Can replace == false, no inputs available.
49+
3350
/// Receive an unconfirmed tx, spend from it, and the unconfirmed tx get's RBF'ed.
3451
/// Our API should be able to recognise that the outgoing tx became evicted and allow the caller
3552
/// to respond accordingly.

wallet/src/wallet/intent_tracker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ impl<A: Anchor> UncanonicalTx<A> {
355355
}
356356

357357
/// Iterate over transactions that are currently canonical in the network, but would be rendered
358-
/// uncanonical if this transaction were to become canonical.
358+
/// uncanonical (be replaced) if this transaction were to become canonical.
359359
///
360360
/// This includes both direct and indirect conflicts, such as any transaction that relies on
361361
/// conflicting ancestry.

0 commit comments

Comments
 (0)