This is a refreshed version of #19463, which was closed after inactivity but there was some mentions of users/external applications at the last CoreDev that would be interested in using this. Unfortunately, I can not recall who was mentioned as a potential user but I would appreciate if someone could ping them to take a look if this is still relevant to them.
This PR leverages the existing prune locks system we already have. The interface of the RPCs of the old PR has been slightly updated, it now matches the pattern used by setban/listbanned exactly. The locks are prefixed to distinguish them from the systems locks and prevent naming colissions. They are not persisted across restarts.
Usage of temporary prune locking may also be helpful in other functional test scenarios but I didn’t spend time to check where might apply.