This is a step toward removing the Chain::Lock class and reducing cs_main
locking.
This change only affects behavior in the case where wallet last block processed
falls behind the chain tip. Previously listsinceblock might not have returned
all transactions up to the claimed "lastblock" value in this case, resulting in
race conditions and potentially missing transactions in cases where
listsinceblock was called in a loop like
https://github.com/bitcoin/bitcoin/issues/14338#issuecomment-426706574
This is part [7/12] of Core PR17954 : https://github.com/bitcoin/bitcoin/pull/17954/commits/f7ba881bc669451a60fedac58a449794702a3e23
Depends on D7869