-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove indexed tx graph (2) #1875
base: master
Are you sure you want to change the base?
Remove indexed tx graph (2) #1875
Conversation
a202349
to
7d8ffae
Compare
in favour of adding a type parameter to TxGraph. When the second type parameter `X: Indexer` is set then TxGraph behaves like `IndexedTxGraph` used to. I reworked the internals of `TxGraph` as I thought things were a bit convoluted. - feat: allow changing the indexer on TxGraph Co-authored: LLFourn
The serialization format of the nested structure is exactly the same as the as the old `indexed_tx_graph::ChangeSet`. The old `tx_graph::ChangeSet` is replaced with `tx_graph::TxChangeSet`.
7d8ffae
to
1c026d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK. tested locally with no issue. I had a question about when we should be calling index_changeset
, and the rest are nits.
@@ -733,44 +888,108 @@ impl<A: Anchor> TxGraph<A> { | |||
for (txid, seen_at) in update.seen_ats { | |||
changeset.merge(self.insert_seen_at(txid, seen_at)); | |||
} | |||
self.index_changeset(&mut changeset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I'm not sure if this line is needed because both insert_tx
and insert_txout
will call index_changeset
.
)) | ||
)] | ||
#[must_use] | ||
pub struct ChangeSet<A = (), XC = ()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could just call this I
, but either way is fine.
pub struct ChangeSet<A = (), XC = ()> { | |
pub struct ChangeSet<A = (), I = ()> { |
} | ||
|
||
/// Changes the [`Indexer`] for a `TxGraph`. **This doesn't re-index the transactions in the | ||
/// graph**. To do that that call [`reindex`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// graph**. To do that that call [`reindex`]. | |
/// graph**. To do that call [`reindex`]. |
@@ -1180,56 +1502,98 @@ impl<A: Ord> Merge for ChangeSet<A> { | |||
} | |||
} | |||
|
|||
impl<A: Ord> ChangeSet<A> { | |||
/// The [`ChangeSet`] represents changes to a [`TxGraph`] and it's internal [`Indexer`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// The [`ChangeSet`] represents changes to a [`TxGraph`] and it's internal [`Indexer`]. | |
/// The [`ChangeSet`] represents changes to a [`TxGraph`] and its internal [`Indexer`]. |
Description
This is a temporary duplicate of #1510 so see if @ValuedMammal is happy with these changes.
tx_graph::ChangeSet
is the nested structure.tx_graph::TxChangeSet
is the changeset without the indexer data.