Fixes #34637.
Was reviewing #34637 and, while reading the new txospender index test code for the first time, found it could use some cleanups. Finding stuff in there is harder than it should be due to the amount of dup code.
The first commit cleans up rpc_gettxspendingprevout.py by introducing
helper functions to avoid repeating the same dicts everywhere, using
for-loops instead of duplicating the same checks for each node, and
renaming variables to better reflect what they actually represent.
The second commit reorganizes txospenderindex_initial_sync()
moving index initialization after the test setup phase, since the index
doesn’t participate in it anyway. It adds a post-sync check to catch
cases where Sync() aborted prematurely.
Note: This is just a pre-work for deeper index changes I’m cooking.