-
Notifications
You must be signed in to change notification settings - Fork 439
Closed
Description
Current implementation of TxGraph insert_tx is:
/// Inserts the given transaction into [`TxGraph`].
///
/// The [`ChangeSet`] returned will be empty if `tx` already exists.
pub fn insert_tx(&mut self, tx: Transaction) -> ChangeSet<A> {
let mut update = Self::default();
update.txs.insert(
tx.txid(),
(TxNodeInternal::Whole(tx.into()), BTreeSet::new(), 0),
);
self.apply_update(update)
}The 0 in the tuple represents the last time the transaction has been seen unconfirmed. I think it is wrong to set 0 here because you should be able to insert transactions into the graph (or wallet) that have never been broadcast and have never been seen. When you list canonical transactions1 you don't want to list transactions that have been inserted but never actually seen. In other words the field should be an Option which is still monotonically increasing with None being the smallest value.
I don't think this change affects the changeset struct, it just changes how you interpret a missing last_seen.
Footnotes
-
Incidentally we should rename
try_list_chain_txstocanonincal_transactions↩
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done