Add required locks in tests

Unit tests with DEBUG_LOCKORDER were running into assertions.
qt: get required locks upfront in polling functions

This avoids the GUI from getting stuck on
periodical polls if the core is holding the locks for a longer time -
for example, during a wallet rescan.
Add missing AssertLockHeld in ConnectBlock
Merge pull request #4085

b39a07d Add missing AssertLockHeld in ConnectBlock (Wladimir J. van der Laan)
41106a5 qt: get required locks upfront in polling functions (Wladimir J. van der Laan)
ed67100 Add required locks in tests (Wladimir J. van der Laan)