def decodescript_script_pub_key(self):
    public_key = '03b0da749730dc9b4b1f4a14d6902877a92541f5368778853d9c4a0cb7802dcfb2'
    push_public_key = ('21' + public_key)
    public_key_hash = '5dd1d3a048119c27b28293056724d9522f26d945'
    push_public_key_hash = ('14' + public_key_hash)
    uncompressed_public_key = '04b0da749730dc9b4b1f4a14d6902877a92541f5368778853d9c4a0cb7802dcfb25e01fc8fde47c96c98a4f3a8123e33a38a50cf9025cc8c4494a518f991792bb7'
    push_uncompressed_public_key = ('41' + uncompressed_public_key)
    p2wsh_p2pk_script_hash = 'd8590cf8ea0674cf3d49fd7ca249b85ef7485dea62c138468bddeb20cd6519f7'
    rpc_result = self.nodes[0].decodescript((push_public_key + 'ac'))
    assert_equal((public_key + ' OP_CHECKSIG'), rpc_result['asm'])
    assert_equal(('0 ' + public_key_hash), rpc_result['segwit']['asm'])
    rpc_result = self.nodes[0].decodescript((('76a9' + push_public_key_hash) + '88ac'))
    assert_equal((('OP_DUP OP_HASH160 ' + public_key_hash) + ' OP_EQUALVERIFY OP_CHECKSIG'), rpc_result['asm'])
    assert_equal(('0 ' + public_key_hash), rpc_result['segwit']['asm'])
    multisig_script = (((('52' + push_public_key) + push_public_key) + push_public_key) + '53ae')
    rpc_result = self.nodes[0].decodescript(multisig_script)
    assert_equal((((((('2 ' + public_key) + ' ') + public_key) + ' ') + public_key) + ' 3 OP_CHECKMULTISIG'), rpc_result['asm'])
    multisig_script_hash = bytes_to_hex_str(sha256(hex_str_to_bytes(multisig_script)))
    assert_equal(('0 ' + multisig_script_hash), rpc_result['segwit']['asm'])
    rpc_result = self.nodes[0].decodescript((('a9' + push_public_key_hash) + '87'))
    assert_equal((('OP_HASH160 ' + public_key_hash) + ' OP_EQUAL'), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
    signature_imposter = '48304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c509001'
    rpc_result = self.nodes[0].decodescript(('6a' + signature_imposter))
    assert_equal(('OP_RETURN ' + signature_imposter[2:]), rpc_result['asm'])
    cltv_script = (((('63' + push_public_key) + 'ad670320a107b17568') + push_public_key) + 'ac')
    rpc_result = self.nodes[0].decodescript(cltv_script)
    assert_equal((((('OP_IF ' + public_key) + ' OP_CHECKSIGVERIFY OP_ELSE 500000 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_ENDIF ') + public_key) + ' OP_CHECKSIG'), rpc_result['asm'])
    cltv_script_hash = bytes_to_hex_str(sha256(hex_str_to_bytes(cltv_script)))
    assert_equal(('0 ' + cltv_script_hash), rpc_result['segwit']['asm'])
    rpc_result = self.nodes[0].decodescript((push_uncompressed_public_key + 'ac'))
    assert_equal((uncompressed_public_key + ' OP_CHECKSIG'), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
    rpc_result = self.nodes[0].decodescript(((('52' + push_public_key) + push_uncompressed_public_key) + '52ae'))
    assert_equal((((('2 ' + public_key) + ' ') + uncompressed_public_key) + ' 2 OP_CHECKMULTISIG'), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
    rpc_result = self.nodes[0].decodescript(('00' + push_public_key_hash))
    assert_equal(('0 ' + public_key_hash), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
    rpc_result = self.nodes[0].decodescript(('0020' + p2wsh_p2pk_script_hash))
    assert_equal(('0 ' + p2wsh_p2pk_script_hash), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
def decodescript_script_pub_key(self):
    public_key = '03b0da749730dc9b4b1f4a14d6902877a92541f5368778853d9c4a0cb7802dcfb2'
    push_public_key = ('21' + public_key)
    public_key_hash = '5dd1d3a048119c27b28293056724d9522f26d945'
    push_public_key_hash = ('14' + public_key_hash)
    uncompressed_public_key = '04b0da749730dc9b4b1f4a14d6902877a92541f5368778853d9c4a0cb7802dcfb25e01fc8fde47c96c98a4f3a8123e33a38a50cf9025cc8c4494a518f991792bb7'
    push_uncompressed_public_key = ('41' + uncompressed_public_key)
    p2wsh_p2pk_script_hash = 'd8590cf8ea0674cf3d49fd7ca249b85ef7485dea62c138468bddeb20cd6519f7'
    rpc_result = self.nodes[0].decodescript((push_public_key + 'ac'))
    assert_equal((public_key + ' OP_CHECKSIG'), rpc_result['asm'])
    assert_equal(('0 ' + public_key_hash), rpc_result['segwit']['asm'])
    rpc_result = self.nodes[0].decodescript((('76a9' + push_public_key_hash) + '88ac'))
    assert_equal((('OP_DUP OP_HASH160 ' + public_key_hash) + ' OP_EQUALVERIFY OP_CHECKSIG'), rpc_result['asm'])
    assert_equal(('0 ' + public_key_hash), rpc_result['segwit']['asm'])
    multisig_script = (((('52' + push_public_key) + push_public_key) + push_public_key) + '53ae')
    rpc_result = self.nodes[0].decodescript(multisig_script)
    assert_equal((((((('2 ' + public_key) + ' ') + public_key) + ' ') + public_key) + ' 3 OP_CHECKMULTISIG'), rpc_result['asm'])
    multisig_script_hash = bytes_to_hex_str(sha256(hex_str_to_bytes(multisig_script)))
    assert_equal(('0 ' + multisig_script_hash), rpc_result['segwit']['asm'])
    rpc_result = self.nodes[0].decodescript((('a9' + push_public_key_hash) + '87'))
    assert_equal((('OP_HASH160 ' + public_key_hash) + ' OP_EQUAL'), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
    signature_imposter = '48304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c509001'
    rpc_result = self.nodes[0].decodescript(('6a' + signature_imposter))
    assert_equal(('OP_RETURN ' + signature_imposter[2:]), rpc_result['asm'])
    cltv_script = (((('63' + push_public_key) + 'ad670320a107b17568') + push_public_key) + 'ac')
    rpc_result = self.nodes[0].decodescript(cltv_script)
    assert_equal((((('OP_IF ' + public_key) + ' OP_CHECKSIGVERIFY OP_ELSE 500000 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_ENDIF ') + public_key) + ' OP_CHECKSIG'), rpc_result['asm'])
    cltv_script_hash = bytes_to_hex_str(sha256(hex_str_to_bytes(cltv_script)))
    assert_equal(('0 ' + cltv_script_hash), rpc_result['segwit']['asm'])
    rpc_result = self.nodes[0].decodescript((push_uncompressed_public_key + 'ac'))
    assert_equal((uncompressed_public_key + ' OP_CHECKSIG'), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
    rpc_result = self.nodes[0].decodescript(((('52' + push_public_key) + push_uncompressed_public_key) + '52ae'))
    assert_equal((((('2 ' + public_key) + ' ') + uncompressed_public_key) + ' 2 OP_CHECKMULTISIG'), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
    rpc_result = self.nodes[0].decodescript(('00' + push_public_key_hash))
    assert_equal(('0 ' + public_key_hash), rpc_result['asm'])
    assert ('segwit' not in rpc_result)
    rpc_result = self.nodes[0].decodescript(('0020' + p2wsh_p2pk_script_hash))
    assert_equal(('0 ' + p2wsh_p2pk_script_hash), rpc_result['asm'])
    assert ('segwit' not in rpc_result)