More work fixing tests (unlocking_test and transfer_test now working).
Fix bug scanning blockchain when blockchain is empty.