def METHOD_NAME(self, tx_type):
    self.log.info("Test with a {} script as the witnessScript".format(tx_type))
    embedded_privkey, embedded_pubkey = generate_keypair(wif=True)
    witness_script = {
        'P2PKH': key_to_p2pkh_script(embedded_pubkey).hex(),
        'P2PK': key_to_p2pk_script(embedded_pubkey).hex()
    }.get(tx_type, "Invalid tx_type")
    redeem_script = script_to_p2wsh_script(witness_script).hex()
    addr = script_to_p2sh(redeem_script)
    script_pub_key = address_to_scriptpubkey(addr).hex()
    # Fund that address
    txid = self.send_to_address(addr, 10)
    vout = find_vout_for_address(self.nodes[0], txid, addr)
    self.generate(self.nodes[0], 1)
    # Now create and sign a transaction spending that output on node[0], which doesn't know the scripts or keys
    spending_tx = self.nodes[0].createrawtransaction([{'txid': txid, 'vout': vout}], {getnewdestination()[2]: Decimal("9.999")})
    spending_tx_signed = self.nodes[0].signrawtransactionwithkey(spending_tx, [embedded_privkey], [{'txid': txid, 'vout': vout, 'scriptPubKey': script_pub_key, 'redeemScript': redeem_script, 'witnessScript': witness_script, 'amount': 10}])
    self.assert_signing_completed_successfully(spending_tx_signed)
    self.nodes[0].sendrawtransaction(spending_tx_signed['hex'])