# Buggy code
def verify_offer_creation(self, assets, timeout):
    """
    Verify whether we are creating a valid order.
    This method raises a RuntimeError if the created order is not valid.
    """
    if assets.first.asset_id == assets.second.asset_id:
        raise RuntimeError("You cannot trade between the same wallet")

    if (
        assets.first.asset_id not in self.wallets
        or not self.wallets[assets.first.asset_id].created
    ):
        raise RuntimeError("Please create a %s wallet first" % assets.first.asset_id)

    if (
        assets.second.asset_id not in self.wallets
        or not self.wallets[assets.second.asset_id].created
    ):
        raise RuntimeError("Please create a %s wallet first" % assets.second.asset_id)

    asset1_min_unit = self.wallets[assets.first.asset_id].min_unit()
    if assets.first.amount < asset1_min_unit:
        raise RuntimeError(
            "The assets to trade should be higher than or equal to the min unit of this asset (%s)."
            % assets.first
        )

    asset2_min_unit = self.wallets[assets.second.asset_id].min_unit()
    if assets.first.amount < asset2_min_unit:
        raise RuntimeError(
            "The assets to trade should be higher than or equal to the min unit of this asset (%s)."
            % assets.second
        )

    if timeout < 0:
        raise RuntimeError("The timeout for this order should be positive")


# Traceback (RuntimeError)
Traceback (most recent call last):
File "/usr/share/tribler/TriblerGUI/event_request_manager.py", line 133, in on_read_data
raise RuntimeError(json_dict["event"]["text"])
RuntimeError: [Failure instance: Traceback: <class 'Tribler.pyipv8.ipv8.messaging.serialization.PackError'>: Could not pack item 7: ('I', 100000000000)
error: 'I' format requires 0 <= number <= 4294967295
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:653:_runCallbacks
/usr/share/tribler/Tribler/community/market/community.py:220:on_peers
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:459:callback
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:567:_startRunCallbacks
--- <exception caught here> ---
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:653:_runCallbacks
/usr/share/tribler/Tribler/community/market/community.py:836:on_peer_address
/usr/share/tribler/Tribler/pyipv8/ipv8/lazy_community.py:171:_ez_pack
/usr/share/tribler/Tribler/pyipv8/ipv8/messaging/serialization.py:270:pack_multiple
/usr/share/tribler/Tribler/pyipv8/ipv8/messaging/serialization.py:264:pack_multiple
/usr/share/tribler/Tribler/pyipv8/ipv8/messaging/serialization.py:248:pack
/usr/share/tribler/Tribler/pyipv8/ipv8/messaging/serialization.py:172:pack
]

# Fixed code
def verify_offer_creation(self, assets, timeout):
    """
    Verify whether we are creating a valid order.
    This method raises a RuntimeError if the created order is not valid.
    """
    if assets.first.asset_id == assets.second.asset_id:
        raise RuntimeError("You cannot trade between the same wallet")

    if (
        assets.first.asset_id not in self.wallets
        or not self.wallets[assets.first.asset_id].created
    ):
        raise RuntimeError("Please create a %s wallet first" % assets.first.asset_id)

    if (
        assets.second.asset_id not in self.wallets
        or not self.wallets[assets.second.asset_id].created
    ):
        raise RuntimeError("Please create a %s wallet first" % assets.second.asset_id)

    asset1_min_unit = self.wallets[assets.first.asset_id].min_unit()
    if assets.first.amount < asset1_min_unit:
        raise RuntimeError(
            "The assets to trade should be higher than or equal to the min unit of this asset (%s)."
            % assets.first
        )

    asset2_min_unit = self.wallets[assets.second.asset_id].min_unit()
    if assets.first.amount < asset2_min_unit:
        raise RuntimeError(
            "The assets to trade should be higher than or equal to the min unit of this asset (%s)."
            % assets.second
        )

    if timeout < 0:
        raise RuntimeError("The timeout for this order should be positive")

    if timeout > 3600 * 24:
        raise RuntimeError("The timeout for this order should be less than a day")