Remove some code duplication and move code that works purely on inputs to the TxInput class.
Keep some shortcuts/helpers in `Transaction`. We can remove them (and avoid a dict -> TxInput conversion) when Transaction entirely works with `TxInput`s instead of coin dicts.
The `multisig_script` function can be converted to using and returning `bytes` to reduce the number of needed conversions, now that it is mainly called in `TxInput`
Depends on D14493