Significant cleanup in order to plumb through fully working signature
tests for both standard and multisig transactions.
  * Modify several of the transaction functions to throw if the
    argument types are incorrect.
  * Fix handling of duplicate signatures in the multisig case
  * Add unit tests
  * Cleanup some minor whitespace issues.
  * Update util functions for minor cleanup