This PR fixes a deadlock caused by methods of ScopedManager read-locking the root manager for WatchOnly() and Locked() calls while the ScopedManager itself is locked. This is the reverse order from the normal way of taking locks, but has been hidden by the fact that DB transactions have never happened in parallel until the upcoming postgres changes in LND.
This PR fixes a deadlock caused by methods of
ScopedManager
read-locking the root manager forWatchOnly()
andLocked()
calls while theScopedManager
itself is locked. This is the reverse order from the normal way of taking locks, but has been hidden by the fact that DB transactions have never happened in parallel until the upcoming postgres changes in LND.See discussion here for more details.
The first commit updates a test to cause this failure. The following commits, pushed after CI completes/tests fail, contain the fix.