Use generators with load_txns_by_prefix
Created by: dagurval
Introduce generators to the code base. Use generators to avoid loading more transactions than needed from bitcoind, as well as avoiding to have to load them all into memory at the same time.
Test plan
./contrib/run_functional_tests.sh