This commit significantly changes the address extraction code. The
original code was written before some of the other newer code was written
and as a result essentially duplicated some of the logic for handling
standard scripts which is used elsewhere in the package.
The following is a summary of what has changed:
- CalcPkScriptAddrHashes, ScriptToAddrHash, and ScriptToAddrHashes have
been replaced by ExtractPkScriptAddresses
- The ScriptType type has been removed in favor of the existing
ScriptClass type
- The new function returns a slice of btcutil.Addresses instead of raw
hashes that the caller then needs to figure out what to do with to
convert them to proper addressses
- The new function makes use of the existing ScriptClass instead of an
nearly duplicate ScriptType
- The new function hooks into the existing infrastructure for parsing
scripts and identifying scripts of standard forms
- The new function only works with pkscripts to match the behavior of the
reference implementation - do note that the redeeming script from a p2sh
script is still considered a pkscript
- The logic combines extraction for all script types instead of using a
separate function for multi-signature transactions
- The new function ignores addresses which are invalid for some reason
such as invalid public keys
Fixed up bad function comment headers
Added a small set of tests for the ScriptToAddrHashes function to test
functionality of a couple real multisig cases as well as error checking