# Path: qa/rpc-tests/test_framework/util.py
# def hex_str_to_bytes(hex_str):
#     return unhexlify(hex_str.encode('ascii'))
# 
# def bytes_to_hex_str(byte_str):
#     return hexlify(byte_str).decode('ascii')


import struct
import socket
import asyncore
import time
import sys
import random
import hashlib
import logging
import copy
import bridgecoin_scrypt
from .util import hex_str_to_bytes, bytes_to_hex_str
from io import BytesIO
from codecs import encode
from threading import RLock
from threading import Thread
from test_framework.siphash import siphash256
        r = b""
        r += self.prevout.serialize()
        r += ser_string(self.scriptSig)
        r += struct.pack("<I", self.nSequence)
        return r

    def __repr__(self):
        return "CTxIn(prevout=%s scriptSig=%s nSequence=%i)" \
            % (repr(self.prevout), bytes_to_hex_str(self.scriptSig),
               self.nSequence)


class CTxOut(object):
    def __init__(self, nValue=0, scriptPubKey=b""):
        self.nValue = nValue
        self.scriptPubKey = scriptPubKey

    def deserialize(self, f):
        self.nValue = struct.unpack("<q", f.read(8))[0]
        self.scriptPubKey = deser_string(f)

    def serialize(self):
        r = b""
        r += struct.pack("<q", self.nValue)
        r += ser_string(self.scriptPubKey)
        return r

    def __repr__(self):
        return "CTxOut(nValue=%i.%08i scriptPubKey=%s)" \
            % (self.nValue // COIN, self.nValue % COIN,

# Path: qa/rpc-tests/test_framework/util.py
# def hex_str_to_bytes(hex_str):
#     return unhexlify(hex_str.encode('ascii'))
# 
# def bytes_to_hex_str(byte_str):
#     return hexlify(byte_str).decode('ascii')


# Path: qa/rpc-tests/test_framework/mininode.py
import struct
import socket
import asyncore
import time
import sys
import random
import hashlib
import logging
import copy
import bridgecoin_scrypt
from .util import hex_str_to_bytes, bytes_to_hex_str
from io import BytesIO
from codecs import encode
from threading import RLock
from threading import Thread
from test_framework.siphash import siphash256

        r = b""
        r += self.prevout.serialize()
        r += ser_string(self.scriptSig)
        r += struct.pack("<I", self.nSequence)
        return r

    def __repr__(self):
        return "CTxIn(prevout=%s scriptSig=%s nSequence=%i)" \
            % (repr(self.prevout), bytes_to_hex_str(self.scriptSig),
               self.nSequence)


class CTxOut(object):
    def __init__(self, nValue=0, scriptPubKey=b""):
        self.nValue = nValue
        self.scriptPubKey = scriptPubKey

    def deserialize(self, f):
        self.nValue = struct.unpack("<q", f.read(8))[0]
        self.scriptPubKey = deser_string(f)

    def serialize(self):
        r = b""
        r += struct.pack("<q", self.nValue)
        r += ser_string(self.scriptPubKey)
        return r

    def __repr__(self):
        return "CTxOut(nValue=%i.%08i scriptPubKey=%s)" \
            % (self.nValue // COIN, self.nValue % COIN,

               bytes_to_hex_str(self.scriptPubKey))