Fix and add test for empty chain and reorg consistency for gettxoutsetinfo.
Summary: backport PR10445 from core. Fix a possible crash.
Test Plan:
make check ../qa/pull-tester/rpc-tests.py blockchain.py
Reviewers: freetrader, CCulianu, #bitcoin_abc
Reviewed By: CCulianu, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D502