Without the changes, g++ will warn to compile under C++20:
```
scheduler.cpp:114:21: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
114 | scheduleFromNow([=] { Repeat(*this, f, delta); }, delta);
| ^
scheduler.cpp:114:21: note: add explicit ‘this’ or ‘*this’ capture
```
This is a partial backport of core#24169
https://github.com/bitcoin/bitcoin/pull/24169/commits/fae2220f4e48934313389864d3d362f672627eb8
Depends on D15314