@@ -155,16 +155,16 @@ impl<'g, A: Anchor, C: ChainOracle> Iterator for CanonicalIter<'g, A, C> {
155155
156156 if let Some ( ( txid, tx, last_seen) ) = self . pending_last_seen . next ( ) {
157157 if !self . is_canonicalized ( txid) {
158- let lsi = LastSeenIn :: Mempool ( last_seen) ;
159- self . mark_canonical ( tx, CanonicalReason :: from_last_seen ( lsi ) ) ;
158+ let observed_in = ObservedIn :: Mempool ( last_seen) ;
159+ self . mark_canonical ( tx, CanonicalReason :: from_observed_in ( observed_in ) ) ;
160160 }
161161 continue ;
162162 }
163163
164164 if let Some ( ( txid, tx, height) ) = self . pending_remaining . pop_front ( ) {
165165 if !self . is_canonicalized ( txid) {
166- let lsi = LastSeenIn :: Block ( height) ;
167- self . mark_canonical ( tx, CanonicalReason :: from_last_seen ( lsi ) ) ;
166+ let observed_in = ObservedIn :: Block ( height) ;
167+ self . mark_canonical ( tx, CanonicalReason :: from_observed_in ( observed_in ) ) ;
168168 }
169169 continue ;
170170 }
@@ -174,13 +174,12 @@ impl<'g, A: Anchor, C: ChainOracle> Iterator for CanonicalIter<'g, A, C> {
174174 }
175175}
176176
177- /// Represents when and where a given transaction is last seen.
178- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , core:: hash:: Hash ) ]
179- #[ cfg_attr( feature = "serde" , derive( serde:: Deserialize , serde:: Serialize ) ) ]
180- pub enum LastSeenIn {
181- /// The transaction was last seen in a block of height.
177+ /// Represents when and where a transaction was last observed in.
178+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
179+ pub enum ObservedIn {
180+ /// The transaction was last observed in a block of height.
182181 Block ( u32 ) ,
183- /// The transaction was last seen in the mempool at the given unix timestamp.
182+ /// The transaction was last observed in the mempool at the given unix timestamp.
184183 Mempool ( u64 ) ,
185184}
186185
@@ -194,12 +193,12 @@ pub enum CanonicalReason<A> {
194193 /// Whether the anchor is of the transaction's descendant.
195194 descendant : Option < Txid > ,
196195 } ,
197- /// This transaction does not conflict with any other transaction with a more recent `last_seen`
198- /// value or one that is anchored in the best chain.
199- LastSeen {
200- /// The [`LastSeenIn `] value of the transaction.
201- last_seen : LastSeenIn ,
202- /// Whether the [`LastSeenIn `] value is of the transaction's descendant.
196+ /// This transaction does not conflict with any other transaction with a more recent
197+ /// [`ObservedIn`] value or one that is anchored in the best chain.
198+ ObservedIn {
199+ /// The [`ObservedIn `] value of the transaction.
200+ observed_in : ObservedIn ,
201+ /// Whether the [`ObservedIn `] value is of the transaction's descendant.
203202 descendant : Option < Txid > ,
204203 } ,
205204}
@@ -214,36 +213,39 @@ impl<A: Clone> CanonicalReason<A> {
214213 }
215214
216215 /// Constructs a [`CanonicalReason`] from a `last_seen` value.
217- pub fn from_last_seen ( last_seen : LastSeenIn ) -> Self {
218- Self :: LastSeen {
219- last_seen ,
216+ pub fn from_observed_in ( observed_in : ObservedIn ) -> Self {
217+ Self :: ObservedIn {
218+ observed_in ,
220219 descendant : None ,
221220 }
222221 }
223222
224223 /// Contruct a new [`CanonicalReason`] from the original which is transitive to `descendant`.
225224 ///
226- /// This signals that either the [`LastSeenIn `] or [`Anchor`] value belongs to the transaction's
225+ /// This signals that either the [`ObservedIn `] or [`Anchor`] value belongs to the transaction's
227226 /// descendant, but is transitively relevant.
228227 pub fn to_transitive ( & self , descendant : Txid ) -> Self {
229228 match self {
230229 CanonicalReason :: Anchor { anchor, .. } => Self :: Anchor {
231230 anchor : anchor. clone ( ) ,
232231 descendant : Some ( descendant) ,
233232 } ,
234- CanonicalReason :: LastSeen { last_seen, .. } => Self :: LastSeen {
235- last_seen : * last_seen,
233+ CanonicalReason :: ObservedIn {
234+ observed_in : last_seen,
235+ ..
236+ } => Self :: ObservedIn {
237+ observed_in : * last_seen,
236238 descendant : Some ( descendant) ,
237239 } ,
238240 }
239241 }
240242
241- /// This signals that either the [`LastSeenIn `] or [`Anchor`] value belongs to the transaction's
243+ /// This signals that either the [`ObservedIn `] or [`Anchor`] value belongs to the transaction's
242244 /// descendant.
243245 pub fn descendant ( & self ) -> & Option < Txid > {
244246 match self {
245247 CanonicalReason :: Anchor { descendant, .. } => descendant,
246- CanonicalReason :: LastSeen { descendant, .. } => descendant,
248+ CanonicalReason :: ObservedIn { descendant, .. } => descendant,
247249 }
248250 }
249251}
0 commit comments