We're going to need this for P2WSH scripts. pull it out into a common file plus adopt the sanity checks so that it will allow for either P2WSH or P2WPKH (previously only encoded P2WPKH scripts)