Got testnet working and used it to fix a large number of bugs in dsr.py
It now seems to work for a simple test case.