Move most of txToPairs into a new createTx func

Also changes it so that it adds new inputs incrementally as needed instead
of starting with an empty tx and adding all inputs again on each iteration.
We can not sign the transaction until all inputs and outputs have been added.  Whenever we end up creating transactions with more than one input, this function will end up creating transactions with invalid input sigscripts.