Skip to content

Commit 55474a6

Browse files
committed
WIP: IntentTracker
1 parent 3ee24ca commit 55474a6

File tree

6 files changed

+800
-398
lines changed

6 files changed

+800
-398
lines changed

wallet/src/wallet/broadcast_queue.rs

Lines changed: 0 additions & 248 deletions
This file was deleted.

wallet/src/wallet/changeset.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bitcoin::Txid;
55
use miniscript::{Descriptor, DescriptorPublicKey};
66
use serde::{Deserialize, Serialize};
77

8-
use super::broadcast_queue;
8+
use super::intent_tracker;
99

1010
type IndexedTxGraphChangeSet =
1111
indexed_tx_graph::ChangeSet<ConfirmationBlockTime, keychain_txout::ChangeSet>;
@@ -117,9 +117,9 @@ pub struct ChangeSet {
117117
pub tx_graph: tx_graph::ChangeSet<ConfirmationBlockTime>,
118118
/// Changes to [`KeychainTxOutIndex`](keychain_txout::KeychainTxOutIndex).
119119
pub indexer: keychain_txout::ChangeSet,
120-
/// Changes to [`BroadcastQueue`](broadcast_queue::BroadcastQueue).
120+
/// Changes to [`IntentTracker`](intent_tracker::IntentTracker).
121121
#[serde(default)]
122-
pub broadcast_queue: broadcast_queue::ChangeSet,
122+
pub intent_tracker: intent_tracker::ChangeSet,
123123
}
124124

125125
impl Merge for ChangeSet {
@@ -151,7 +151,7 @@ impl Merge for ChangeSet {
151151
Merge::merge(&mut self.local_chain, other.local_chain);
152152
Merge::merge(&mut self.tx_graph, other.tx_graph);
153153
Merge::merge(&mut self.indexer, other.indexer);
154-
Merge::merge(&mut self.broadcast_queue, other.broadcast_queue);
154+
Merge::merge(&mut self.intent_tracker, other.intent_tracker);
155155
}
156156

157157
fn is_empty(&self) -> bool {
@@ -161,7 +161,7 @@ impl Merge for ChangeSet {
161161
&& self.local_chain.is_empty()
162162
&& self.tx_graph.is_empty()
163163
&& self.indexer.is_empty()
164-
&& self.broadcast_queue.is_empty()
164+
&& self.intent_tracker.is_empty()
165165
}
166166
}
167167

@@ -249,9 +249,9 @@ impl ChangeSet {
249249
for row in row_iter {
250250
let Impl(txid) = row?;
251251
changeset
252-
.broadcast_queue
252+
.intent_tracker
253253
.mutations
254-
.push(broadcast_queue::Mutation::Push(txid));
254+
.push(intent_tracker::Mutation::Push(txid));
255255
}
256256

257257
changeset.local_chain = local_chain::ChangeSet::from_sqlite(db_tx)?;
@@ -310,12 +310,12 @@ impl ChangeSet {
310310
"DELETE FROM {} WHERE txid=:txid",
311311
Self::WALLET_BROADCAST_QUEUE_TABLE_NAME
312312
))?;
313-
for mutation in &self.broadcast_queue.mutations {
313+
for mutation in &self.intent_tracker.mutations {
314314
match mutation {
315-
broadcast_queue::Mutation::Push(txid) => {
315+
intent_tracker::Mutation::Push(txid) => {
316316
queue_insert_statement.execute(named_params! { ":txid": Impl(*txid) })?;
317317
}
318-
broadcast_queue::Mutation::Remove(txid) => {
318+
intent_tracker::Mutation::Remove(txid) => {
319319
queue_remove_statement.execute(named_params! { ":txid": Impl(*txid) })?;
320320
}
321321
}
@@ -365,10 +365,10 @@ impl From<keychain_txout::ChangeSet> for ChangeSet {
365365
}
366366
}
367367

368-
impl From<broadcast_queue::ChangeSet> for ChangeSet {
369-
fn from(broadcast_queue: broadcast_queue::ChangeSet) -> Self {
368+
impl From<intent_tracker::ChangeSet> for ChangeSet {
369+
fn from(broadcast_queue: intent_tracker::ChangeSet) -> Self {
370370
Self {
371-
broadcast_queue,
371+
intent_tracker: broadcast_queue,
372372
..Default::default()
373373
}
374374
}

0 commit comments

Comments
 (0)