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.
Actually, there is - Credits is not defined as []Credit, but []CreditInterface. This might have been a mistake, but made testing very easy. I have to look closer at how to fix this.