Skip to content

Commit 6dce99e

Browse files
authored
Merge pull request #2092 from mintlayer/add_todo
Add a TODO
2 parents cbd6b9e + 3b324da commit 6dce99e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

wallet/wallet-rpc-lib/src/service/worker.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ where
111111
}
112112

113113
// Background wallet sync if there's nothing else to do
114+
// TODO: due to being in a `select!` arm, the future returned by `background_task`
115+
// can be cancelled. Currently it invokes the entire `Controller::run`, which
116+
// performs staking and submits generated blocks, checks for mempool events (in
117+
// a separate `select!` loop) etc. This may lead to a block not being submitted,
118+
// mempool events being lost etc.
119+
// So this must be refactored:
120+
// 1. Only this `select!` should remain. Mempool events should be received at this
121+
// level and forwarded to the controller.
122+
// 2. `Controller::run` should become `do_periodic_work`, i.e. it should perform
123+
// only one iteration of its work loop.
124+
// 3. `do_periodic_work` should be called at regular intervals.
114125
result = Self::background_task(&mut self.controller) => {
115126
match result {
116127
Ok(never) => match never {},

0 commit comments

Comments
 (0)