# Path: jmclient/jmclient/configure.py
# def load_test_config(**kwargs):
#     if "config_path" not in kwargs:
#         load_program_config(config_path=".", **kwargs)
#     else:
#         load_program_config(**kwargs)
# 
# def get_irc_mchannels():
#     SECTION_NAME = 'MESSAGING'
#     # FIXME: remove in future release
#     if jm_single().config.has_section(SECTION_NAME):
#         log.warning("Old IRC configuration detected. Please adopt your "
#                     "joinmarket.cfg as documented in 'docs/config-irc-"
#                     "update.md'. Support for the old setting will be removed "
#                     "in a future version.")
#         return _get_irc_mchannels_old()
# 
#     SECTION_NAME += ':'
#     irc_sections = []
#     for s in jm_single().config.sections():
#         if s.startswith(SECTION_NAME):
#             irc_sections.append(s)
#     assert irc_sections
# 
#     req_fields = [("host", str), ("port", int), ("channel", str), ("usessl", str)]
# 
#     configs = []
#     for section in irc_sections:
#         server_data = {}
# 
#         # check if socks5 is enabled for tor and load relevant config if so
#         try:
#             server_data["socks5"] = jm_single().config.get(section, "socks5")
#         except NoOptionError:
#             server_data["socks5"] = "false"
#         if server_data["socks5"].lower() == 'true':
#             server_data["socks5_host"] = jm_single().config.get(section, "socks5_host")
#             server_data["socks5_port"] = jm_single().config.get(section, "socks5_port")
# 
#         for option, otype in req_fields:
#             val = jm_single().config.get(section, option)
#             server_data[option] = otype(val)
#         server_data['btcnet'] = get_network()
#         configs.append(server_data)
#     return configs


import pytest
from jmdaemon.orderbookwatch import OrderbookWatch
from jmdaemon import IRCMessageChannel, fidelity_bond_cmd_list
from jmclient import get_irc_mchannels, load_test_config
from jmdaemon.protocol import JM_VERSION, ORDER_KEYS
from jmbase.support import hextobin
from jmclient.fidelity_bond import FidelityBondProof
            { #nicksig len = 70, certsig len = 71
            "nick-signature": (b'0D\x02 K)\xe9\x17d\x0b\xc0\x82(\xd1\xa2*l\xd8\x0eJ\xc7\x01NV\xbf'
                + b'\xcb\x02O]\xc0\x11\x01\x01B"\xed\x02 ob\xa1\xf8>\x80U)\xc8\x96\x86\x1b \x0e'
                + b'\x00.\xf8\x86}\xcd\xf8\x82T\xa2\xb5\x8a4\xdb4\xbe\xf3{'),
            "certificate-signature": ("3045022100d3beb5660bef33d095f92a3023bbbab15ece48ab2f211fa"
                + "935b62fe8b764c8c002204892deffb4c9aa0d734aa3f55cc8e2baae4a03fc5a9e571b4f671493"
                + "f1254df9"),
            "certificate-pubkey": "03a2d1d15290d6d21204d1153c062970b4ff757a675e47a451fd0ba5c084127807",
            "certificate-expiry": 1,
            "utxo-pubkey": "03b9c12c9c31286772349b986653d07232327b284bd0787ad5829a04ac68f59b89",
            "txid": "70c2995b283db086813d97817264f10b8823b870298d30ab09cb43c6bf2670cf",
            "vout": 0,
            "locktime": 1735689600
            },
            "J59PRzM6ZsdA5uyJ",
            "J55VZ6U6ZyFDNeuv"
        ),
        (
            False,
            { #nick signature with no DER header
            "nick-signature": (b'ZD\x02 K)\xe9\x17d\x0b\xc0\x82(\xd1\xa2*l\xd8\x0eJ\xc7\x01NV\xbf'
                + b'\xcb\x02O]\xc0\x11\x01\x01B"\xed\x02 ob\xa1\xf8>\x80U)\xc8\x96\x86\x1b \x0e'
                + b'\x00.\xf8\x86}\xcd\xf8\x82T\xa2\xb5\x8a4\xdb4\xbe\xf3{'),
            "certificate-signature": ("3045022100d3beb5660bef33d095f92a3023bbbab15ece48ab2f211fa"
                + "935b62fe8b764c8c002204892deffb4c9aa0d734aa3f55cc8e2baae4a03fc5a9e571b4f671493"
                + "f1254df9"),
            "certificate-pubkey": "03a2d1d15290d6d21204d1153c062970b4ff757a675e47a451fd0ba5c084127807",
            "certificate-expiry": 1,
            "utxo-pubkey": "03b9c12c9c31286772349b986653d07232327b284bd0787ad5829a04ac68f59b89",
            "txid": "70c2995b283db086813d97817264f10b8823b870298d30ab09cb43c6bf2670cf",

# Path: jmclient/jmclient/configure.py
# def load_test_config(**kwargs):
#     if "config_path" not in kwargs:
#         load_program_config(config_path=".", **kwargs)
#     else:
#         load_program_config(**kwargs)
# 
# def get_irc_mchannels():
#     SECTION_NAME = 'MESSAGING'
#     # FIXME: remove in future release
#     if jm_single().config.has_section(SECTION_NAME):
#         log.warning("Old IRC configuration detected. Please adopt your "
#                     "joinmarket.cfg as documented in 'docs/config-irc-"
#                     "update.md'. Support for the old setting will be removed "
#                     "in a future version.")
#         return _get_irc_mchannels_old()
# 
#     SECTION_NAME += ':'
#     irc_sections = []
#     for s in jm_single().config.sections():
#         if s.startswith(SECTION_NAME):
#             irc_sections.append(s)
#     assert irc_sections
# 
#     req_fields = [("host", str), ("port", int), ("channel", str), ("usessl", str)]
# 
#     configs = []
#     for section in irc_sections:
#         server_data = {}
# 
#         # check if socks5 is enabled for tor and load relevant config if so
#         try:
#             server_data["socks5"] = jm_single().config.get(section, "socks5")
#         except NoOptionError:
#             server_data["socks5"] = "false"
#         if server_data["socks5"].lower() == 'true':
#             server_data["socks5_host"] = jm_single().config.get(section, "socks5_host")
#             server_data["socks5_port"] = jm_single().config.get(section, "socks5_port")
# 
#         for option, otype in req_fields:
#             val = jm_single().config.get(section, option)
#             server_data[option] = otype(val)
#         server_data['btcnet'] = get_network()
#         configs.append(server_data)
#     return configs


# Path: jmdaemon/test/test_orderbookwatch.py
import pytest
from jmdaemon.orderbookwatch import OrderbookWatch
from jmdaemon import IRCMessageChannel, fidelity_bond_cmd_list
from jmclient import get_irc_mchannels, load_test_config
from jmdaemon.protocol import JM_VERSION, ORDER_KEYS
from jmbase.support import hextobin
from jmclient.fidelity_bond import FidelityBondProof

            { #nicksig len = 70, certsig len = 71
            "nick-signature": (b'0D\x02 K)\xe9\x17d\x0b\xc0\x82(\xd1\xa2*l\xd8\x0eJ\xc7\x01NV\xbf'
                + b'\xcb\x02O]\xc0\x11\x01\x01B"\xed\x02 ob\xa1\xf8>\x80U)\xc8\x96\x86\x1b \x0e'
                + b'\x00.\xf8\x86}\xcd\xf8\x82T\xa2\xb5\x8a4\xdb4\xbe\xf3{'),
            "certificate-signature": ("3045022100d3beb5660bef33d095f92a3023bbbab15ece48ab2f211fa"
                + "935b62fe8b764c8c002204892deffb4c9aa0d734aa3f55cc8e2baae4a03fc5a9e571b4f671493"
                + "f1254df9"),
            "certificate-pubkey": "03a2d1d15290d6d21204d1153c062970b4ff757a675e47a451fd0ba5c084127807",
            "certificate-expiry": 1,
            "utxo-pubkey": "03b9c12c9c31286772349b986653d07232327b284bd0787ad5829a04ac68f59b89",
            "txid": "70c2995b283db086813d97817264f10b8823b870298d30ab09cb43c6bf2670cf",
            "vout": 0,
            "locktime": 1735689600
            },
            "J59PRzM6ZsdA5uyJ",
            "J55VZ6U6ZyFDNeuv"
        ),
        (
            False,
            { #nick signature with no DER header
            "nick-signature": (b'ZD\x02 K)\xe9\x17d\x0b\xc0\x82(\xd1\xa2*l\xd8\x0eJ\xc7\x01NV\xbf'
                + b'\xcb\x02O]\xc0\x11\x01\x01B"\xed\x02 ob\xa1\xf8>\x80U)\xc8\x96\x86\x1b \x0e'
                + b'\x00.\xf8\x86}\xcd\xf8\x82T\xa2\xb5\x8a4\xdb4\xbe\xf3{'),
            "certificate-signature": ("3045022100d3beb5660bef33d095f92a3023bbbab15ece48ab2f211fa"
                + "935b62fe8b764c8c002204892deffb4c9aa0d734aa3f55cc8e2baae4a03fc5a9e571b4f671493"
                + "f1254df9"),
            "certificate-pubkey": "03a2d1d15290d6d21204d1153c062970b4ff757a675e47a451fd0ba5c084127807",
            "certificate-expiry": 1,
            "utxo-pubkey": "03b9c12c9c31286772349b986653d07232327b284bd0787ad5829a04ac68f59b89",
            "txid": "70c2995b283db086813d97817264f10b8823b870298d30ab09cb43c6bf2670cf",

            "vout": 0,