Input selection algorithm

Rebased to vp-withdrawal.

Note I had to make some minor changes to make the test run again.

Also the createInputs and createInputsStore needs to be cleaned up. They are both taking a store right now and especially the createInputsStore name is misleading.
Is there any reason why you're returning Credits instead of []txstore.Credit? From the callers perspective I don't think we need the former, so we could probably return just the underlying txstore.Credit items after we're done with the sorting