File tree Expand file tree Collapse file tree
wallet/wallet-rpc-lib/src/service Expand file tree Collapse file tree Original file line number Diff line number Diff 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 { } ,
You can’t perform that action at this time.
0 commit comments