Browse Source

fixes on flake8 output

add_frost
zebra-lucky 2 weeks ago
parent
commit
2d2e92f5a5
  1. 2
      conftest.py
  2. 2
      scripts/add-utxo.py
  3. 1
      scripts/bencode.py
  4. 2
      scripts/bond-calculator.py
  5. 2
      scripts/bumpfee.py
  6. 2
      scripts/genwallet.py
  7. 6
      scripts/joinmarket-qt.py
  8. 2
      scripts/receive-payjoin.py
  9. 2
      scripts/sendpayment.py
  10. 2
      scripts/sendtomany.py
  11. 2
      scripts/snicker/create-snicker-proposal.py
  12. 2
      scripts/snicker/receive-snicker.py
  13. 2
      scripts/snicker/snicker-finder.py
  14. 2
      scripts/snicker/snicker-recovery.py
  15. 2
      scripts/snicker/snicker-seed-tx.py
  16. 2
      scripts/snicker/snicker-server.py
  17. 2
      scripts/tumbler.py
  18. 3
      scripts/wallet-tool.py
  19. 5
      scripts/yg-privacyenhanced.py
  20. 2
      scripts/yield-generator-basic.py
  21. 1
      src/jmclient/blockchaininterface.py
  22. 10
      src/jmclient/client_protocol.py
  23. 2
      src/jmclient/commitment_utils.py
  24. 9
      src/jmclient/frost_clients.py
  25. 3
      src/jmclient/maker.py
  26. 1
      src/jmclient/podle.py
  27. 1
      src/jmclient/taker_utils.py
  28. 2
      src/jmclient/wallet.py
  29. 4
      src/jmclient/wallet_service.py
  30. 5
      src/jmclient/wallet_utils.py
  31. 6
      src/jmfrost/frost_ref/reference.py
  32. 4
      test/jmclient/commontest.py
  33. 4
      test/jmclient/test_client_protocol.py
  34. 2
      test/jmclient/test_coinjoin.py
  35. 3
      test/jmclient/test_core_nohistory_sync.py
  36. 5
      test/jmclient/test_frost_clients.py
  37. 11
      test/jmclient/test_frost_ipc.py
  38. 4
      test/jmclient/test_frost_wallet.py
  39. 5
      test/jmclient/test_maker.py
  40. 3
      test/jmclient/test_psbt_wallet.py
  41. 3
      test/jmclient/test_snicker.py
  42. 3
      test/jmclient/test_taker.py
  43. 3
      test/jmclient/test_taproot_wallet.py
  44. 3
      test/jmclient/test_tx_creation.py
  45. 5
      test/jmclient/test_utxomanager.py
  46. 5
      test/jmclient/test_wallet.py
  47. 2
      test/jmclient/test_wallet_rpc.py
  48. 2
      test/jmclient/test_websocket.py
  49. 3
      test/jmclient/test_yieldgenerator.py
  50. 1
      test/jmfrost/test_frost_ref.py
  51. 4
      test/unified/common.py
  52. 8
      test/unified/test_e2e_coinjoin.py

2
conftest.py

@ -7,7 +7,7 @@ from typing import Any, Tuple
import pytest import pytest
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
def get_bitcoind_version(bitcoind_path: str, conf: str) -> Tuple[int, int]: def get_bitcoind_version(bitcoind_path: str, conf: str) -> Tuple[int, int]:

2
scripts/add-utxo.py

@ -12,7 +12,7 @@ import json
from pprint import pformat from pprint import pformat
from optparse import OptionParser from optparse import OptionParser
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

1
scripts/bencode.py

@ -3,7 +3,6 @@
import click import click
import json import json
from pprint import pprint
from fastbencode import bencode_utf8 from fastbencode import bencode_utf8

2
scripts/bond-calculator.py

@ -7,7 +7,7 @@ from decimal import Decimal
from json import loads from json import loads
from optparse import OptionParser from optparse import OptionParser
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/bumpfee.py

@ -3,7 +3,7 @@
import asyncio import asyncio
from decimal import Decimal from decimal import Decimal
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/genwallet.py

@ -7,7 +7,7 @@ import asyncio
import os import os
from optparse import OptionParser from optparse import OptionParser
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

6
scripts/joinmarket-qt.py

@ -21,7 +21,7 @@ Some widgets copied and modified from https://github.com/spesmilo/electrum
import asyncio import asyncio
import sys, datetime, os, logging import sys, datetime, os, logging
import platform, json, time import platform, json
from optparse import OptionParser from optparse import OptionParser
from typing import Optional, Tuple from typing import Optional, Tuple
@ -77,7 +77,7 @@ from jmclient import load_program_config, get_network, update_persist_config,\
from jmclient.wallet import BaseWallet from jmclient.wallet import BaseWallet
from qtsupport import (ScheduleWizard, TumbleRestartWizard, config_tips, from qtsupport import (ScheduleWizard, TumbleRestartWizard, config_tips,
config_types, QtHandler, XStream, Buttons, OkButton, CancelButton, config_types, QtHandler, XStream,
JMPasswordDialog, MyTreeWidget, JMQtMessageBox, BLUE_FG, JMPasswordDialog, MyTreeWidget, JMQtMessageBox, BLUE_FG,
donation_more_message, BitcoinAmountEdit, JMIntValidator, donation_more_message, BitcoinAmountEdit, JMIntValidator,
ReceiveBIP78Dialog, QRCodePopup, JMExportPrivkeysDialog, ReceiveBIP78Dialog, QRCodePopup, JMExportPrivkeysDialog,
@ -2573,7 +2573,7 @@ def qt_exception_handler(context):
async def main(): async def main():
global logsdir, tumble_log, mainWindow global logsdir, tumble_log
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
loop.set_exception_handler(qt_exception_handler) loop.set_exception_handler(qt_exception_handler)

2
scripts/receive-payjoin.py

@ -5,7 +5,7 @@ from optparse import OptionParser
import sys import sys
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/sendpayment.py

@ -11,7 +11,7 @@ import asyncio
import sys import sys
import pprint import pprint
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/sendtomany.py

@ -9,7 +9,7 @@ import asyncio
from optparse import OptionParser from optparse import OptionParser
import jmbitcoin as btc import jmbitcoin as btc
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/snicker/create-snicker-proposal.py

@ -25,7 +25,7 @@ import asyncio
import sys import sys
from optparse import OptionParser from optparse import OptionParser
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/snicker/receive-snicker.py

@ -4,7 +4,7 @@ import asyncio
from optparse import OptionParser from optparse import OptionParser
import sys import sys
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/snicker/snicker-finder.py

@ -28,7 +28,7 @@ import asyncio
import sys import sys
from optparse import OptionParser from optparse import OptionParser
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/snicker/snicker-recovery.py

@ -28,7 +28,7 @@ import asyncio
import sys import sys
from optparse import OptionParser from optparse import OptionParser
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/snicker/snicker-seed-tx.py

@ -24,7 +24,7 @@ import sys
import random import random
from optparse import OptionParser from optparse import OptionParser
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/snicker/snicker-server.py

@ -24,7 +24,7 @@ arguments:
import asyncio import asyncio
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

2
scripts/tumbler.py

@ -3,7 +3,7 @@
import asyncio import asyncio
import sys import sys
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

3
scripts/wallet-tool.py

@ -1,9 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import asyncio import asyncio
import sys
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

5
scripts/yg-privacyenhanced.py

@ -4,11 +4,12 @@ import asyncio
import random import random
import sys import sys
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task
from jmbase import get_log, jmprint, EXIT_ARGERROR from jmbase import get_log, jmprint, EXIT_ARGERROR
from jmclient import YieldGeneratorBasic, ygmain, jm_single
from jmbitcoin import amount_to_str from jmbitcoin import amount_to_str
# This is a maker for the purposes of generating a yield from held bitcoins # This is a maker for the purposes of generating a yield from held bitcoins
@ -19,8 +20,10 @@ from jmbitcoin import amount_to_str
# YIELD GENERATOR SETTINGS ARE NOW IN YOUR joinmarket.cfg CONFIG FILE # YIELD GENERATOR SETTINGS ARE NOW IN YOUR joinmarket.cfg CONFIG FILE
# (You can also use command line flags; see --help for this script). # (You can also use command line flags; see --help for this script).
jlog = get_log() jlog = get_log()
class YieldGeneratorPrivacyEnhanced(YieldGeneratorBasic): class YieldGeneratorPrivacyEnhanced(YieldGeneratorBasic):
def __init__(self, wallet_service, offerconfig): def __init__(self, wallet_service, offerconfig):

2
scripts/yield-generator-basic.py

@ -2,7 +2,7 @@
import asyncio import asyncio
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmclient.scripts_support import wrap_main, finalize_main_task from jmclient.scripts_support import wrap_main, finalize_main_task

1
src/jmclient/blockchaininterface.py

@ -1,7 +1,6 @@
import ast import ast
import binascii import binascii
import random import random
import sys
import time import time
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from decimal import Decimal from decimal import Decimal

10
src/jmclient/client_protocol.py

@ -1,4 +1,4 @@
#! /usr/bin/env python # -*- coding: utf-8 -*-
import asyncio import asyncio
import base64 import base64
@ -11,7 +11,7 @@ try:
from twisted.internet.ssl import ClientContextFactory from twisted.internet.ssl import ClientContextFactory
except ImportError: except ImportError:
pass pass
from jmbase import commands, jmprint from jmbase import commands
import binascii import binascii
import json import json
import hashlib import hashlib
@ -405,7 +405,7 @@ class JMClientProtocol(BaseClientProtocol):
"""DKG specifics """DKG specifics
""" """
async def dkg_gen(self): async def dkg_gen(self):
jlog.debug(f'Coordinator call dkg_gen') jlog.debug('Coordinator call dkg_gen')
client = self.factory.client client = self.factory.client
md_type_idx = None md_type_idx = None
session_id = None session_id = None
@ -528,7 +528,7 @@ class JMClientProtocol(BaseClientProtocol):
client = self.factory.client client = self.factory.client
bin_session_id = hextobin(session_id) bin_session_id = hextobin(session_id)
jlog.debug(f'Coordinator get dkgfinalized') jlog.debug('Coordinator get dkgfinalized')
client.on_dkg_finalized(nick, bin_session_id) client.on_dkg_finalized(nick, bin_session_id)
return {'accepted': True} return {'accepted': True}
@ -584,7 +584,7 @@ class JMClientProtocol(BaseClientProtocol):
"""FROST specifics """FROST specifics
""" """
def frost_req(self, dkg_session_id, msg_bytes): def frost_req(self, dkg_session_id, msg_bytes):
jlog.debug(f'Coordinator call frost_req') jlog.debug('Coordinator call frost_req')
client = self.factory.client client = self.factory.client
hostpubkeyhash, sig, session_id = client.frost_req( hostpubkeyhash, sig, session_id = client.frost_req(
dkg_session_id, msg_bytes) dkg_session_id, msg_bytes)

2
src/jmclient/commitment_utils.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import sys
from jmbase import (jmprint, utxostr_to_utxo, utxo_to_utxostr, EXIT_FAILURE, from jmbase import (jmprint, utxostr_to_utxo, utxo_to_utxostr, EXIT_FAILURE,
twisted_sys_exit) twisted_sys_exit)
from jmclient import jm_single, BTCEngine, BTC_P2PKH, BTC_P2SH_P2WPKH, BTC_P2WPKH from jmclient import jm_single, BTCEngine, BTC_P2PKH, BTC_P2SH_P2WPKH, BTC_P2WPKH

9
src/jmclient/frost_clients.py

@ -12,20 +12,13 @@ from jmbase import hextobin, get_log
from jmbitcoin import CCoinKey from jmbitcoin import CCoinKey
from jmclient.configure import jm_single from jmclient.configure import jm_single
from jmfrost.chilldkg_ref.chilldkg import ( from jmfrost.chilldkg_ref.chilldkg import (
params_id,
hostpubkey_gen, hostpubkey_gen,
participant_step1, participant_step1,
participant_step2, participant_step2,
participant_finalize, participant_finalize,
participant_investigate,
coordinator_step1, coordinator_step1,
coordinator_finalize, coordinator_finalize,
coordinator_investigate,
SessionParams, SessionParams,
DKGOutput,
RecoveryData,
FaultyParticipantOrCoordinatorError,
UnknownFaultyParticipantOrCoordinatorError,
ParticipantMsg1, ParticipantMsg1,
ParticipantMsg2, ParticipantMsg2,
CoordinatorMsg1, CoordinatorMsg1,
@ -259,7 +252,7 @@ class DKGClient:
raise Exception(f'pubkey for {pubkeyhash.hex()} not found') raise Exception(f'pubkey for {pubkeyhash.hex()} not found')
xpubkey = XOnlyPubKey(pubkey[1:]) xpubkey = XOnlyPubKey(pubkey[1:])
if not xpubkey.verify_schnorr(session_id, hextobin(sig)): if not xpubkey.verify_schnorr(session_id, hextobin(sig)):
raise Exception(f'signature verification failed') raise Exception('signature verification failed')
if pubkey in coordinator.parties: if pubkey in coordinator.parties:
jlog.debug(f'pubkey {pubkey.hex()} already in' jlog.debug(f'pubkey {pubkey.hex()} already in'
f' coordinator parties') f' coordinator parties')

3
src/jmclient/maker.py

@ -1,13 +1,12 @@
import base64 import base64
import hashlib import hashlib
import sys
import abc import abc
import atexit import atexit
from bitcointx.wallet import CCoinKey, XOnlyPubKey, tap_tweak_pubkey from bitcointx.wallet import CCoinKey, XOnlyPubKey, tap_tweak_pubkey
import jmbitcoin as btc import jmbitcoin as btc
from jmbase import (bintohex, hexbin, async_hexbin, get_log, EXIT_FAILURE, from jmbase import (bintohex, async_hexbin, get_log, EXIT_FAILURE,
twisted_sys_exit) twisted_sys_exit)
from jmclient.wallet import TaprootWallet, FrostWallet from jmclient.wallet import TaprootWallet, FrostWallet
from jmclient.wallet_service import WalletService from jmclient.wallet_service import WalletService

1
src/jmclient/podle.py

@ -1,7 +1,6 @@
#Proof Of Discrete Logarithm Equivalence #Proof Of Discrete Logarithm Equivalence
#For algorithm steps, see https://gist.github.com/AdamISZ/9cbba5e9408d23813ca8 #For algorithm steps, see https://gist.github.com/AdamISZ/9cbba5e9408d23813ca8
import os import os
import sys
import hashlib import hashlib
import json import json
import struct import struct

1
src/jmclient/taker_utils.py

@ -2,7 +2,6 @@ import asyncio
import logging import logging
import pprint import pprint
import os import os
import sys
import time import time
import numbers import numbers
from typing import Callable, List, Optional, Tuple, Union from typing import Callable, List, Optional, Tuple, Union

2
src/jmclient/wallet.py

@ -32,7 +32,6 @@ from .cryptoengine import TYPE_P2PKH, TYPE_P2SH_P2WPKH, TYPE_P2WSH,\
TYPE_WATCHONLY_P2WPKH, TYPE_P2TR, TYPE_P2TR_FROST, ENGINES, \ TYPE_WATCHONLY_P2WPKH, TYPE_P2TR, TYPE_P2TR_FROST, ENGINES, \
detect_script_type, EngineError, TYPE_TAPROOT_WALLET_FIDELITY_BONDS, \ detect_script_type, EngineError, TYPE_TAPROOT_WALLET_FIDELITY_BONDS, \
TYPE_TAPROOT_WATCHONLY_FIDELITY_BONDS, TYPE_WATCHONLY_P2TR TYPE_TAPROOT_WATCHONLY_FIDELITY_BONDS, TYPE_WATCHONLY_P2TR
from .storage import DKGRecoveryStorage
from .support import get_random_bytes from .support import get_random_bytes
from . import mn_encode, mn_decode from . import mn_encode, mn_decode
import jmbitcoin as btc import jmbitcoin as btc
@ -40,7 +39,6 @@ from jmbase import JM_WALLET_NAME_PREFIX, bintohex, hextobin, jmprint, get_log
from jmfrost.chilldkg_ref import chilldkg from jmfrost.chilldkg_ref import chilldkg
from .frost_clients import (chilldkg_hexlify, decrypt_ext_recovery, from .frost_clients import (chilldkg_hexlify, decrypt_ext_recovery,
deserialize_ext_recovery, serialize_ext_recovery) deserialize_ext_recovery, serialize_ext_recovery)
from jmfrost.chilldkg_ref.chilldkg import hostpubkey_gen
jlog = get_log() jlog = get_log()

4
src/jmclient/wallet_service.py

@ -8,8 +8,6 @@ from typing import Dict, List, Optional, Set, Tuple
from decimal import Decimal from decimal import Decimal
from copy import deepcopy from copy import deepcopy
from twisted.internet import reactor from twisted.internet import reactor
from twisted.internet import task
from twisted.internet.defer import Deferred
from twisted.application.service import Service from twisted.application.service import Service
from numbers import Integral from numbers import Integral
import jmbitcoin as btc import jmbitcoin as btc
@ -326,7 +324,7 @@ class WalletService(Service):
async def transaction_monitor(self): async def transaction_monitor(self):
"""Keeps track of any changes in the wallet (new transactions). """Keeps track of any changes in the wallet (new transactions).
Intended to be run as a twisted task.LoopingCall so that this Intended to be run as a asyncio Task so that this
Service is constantly in near-realtime sync with the blockchain. Service is constantly in near-realtime sync with the blockchain.
""" """

5
src/jmclient/wallet_utils.py

@ -12,8 +12,6 @@ from collections import Counter, defaultdict
from itertools import islice, chain from itertools import islice, chain
from typing import Callable, Optional, Tuple, Union from typing import Callable, Optional, Tuple, Union
from twisted.internet import reactor, task
from jmclient import (get_network, WALLET_IMPLEMENTATIONS, Storage, podle, from jmclient import (get_network, WALLET_IMPLEMENTATIONS, Storage, podle,
jm_single, WalletError, BaseWallet, VolatileStorage, DKGRecoveryStorage, jm_single, WalletError, BaseWallet, VolatileStorage, DKGRecoveryStorage,
StoragePasswordError, is_taproot_mode, is_segwit_mode, SegwitLegacyWallet, StoragePasswordError, is_taproot_mode, is_segwit_mode, SegwitLegacyWallet,
@ -24,7 +22,6 @@ from jmclient import (get_network, WALLET_IMPLEMENTATIONS, Storage, podle,
from jmclient.blockchaininterface import (BitcoinCoreInterface, from jmclient.blockchaininterface import (BitcoinCoreInterface,
BitcoinCoreNoHistoryInterface) BitcoinCoreNoHistoryInterface)
from jmclient.wallet_service import WalletService from jmclient.wallet_service import WalletService
from jmbase import stop_reactor
from jmbase.support import (get_password, jmprint, EXIT_FAILURE, from jmbase.support import (get_password, jmprint, EXIT_FAILURE,
EXIT_ARGERROR, utxo_to_utxostr, hextobin, bintohex, EXIT_ARGERROR, utxo_to_utxostr, hextobin, bintohex,
IndentedHelpFormatterWithNL, dict_factory, IndentedHelpFormatterWithNL, dict_factory,
@ -459,7 +456,7 @@ async def wallet_showutxos(wallet_service: WalletService, showprivkey: bool,
for md in _utxos: for md in _utxos:
(enabled, disabled) = await get_utxos_enabled_disabled(wallet_service, (enabled, disabled) = await get_utxos_enabled_disabled(wallet_service,
md) md)
for u, av in utxos[md].items(): for u, av in _utxos[md].items():
success, us = utxo_to_utxostr(u) success, us = utxo_to_utxostr(u)
assert success assert success
key = wallet_service._get_key_from_path(av["path"])[0] key = wallet_service._get_key_from_path(av["path"])[0]

6
src/jmfrost/frost_ref/reference.py

@ -10,15 +10,13 @@
# be used in production environments. The code is vulnerable to timing attacks, # be used in production environments. The code is vulnerable to timing attacks,
# for example. # for example.
from typing import Any, List, Optional, Tuple, NewType, NamedTuple, Sequence from typing import List, Optional, Tuple, NewType, NamedTuple, Sequence
import itertools import itertools
import secrets import secrets
import time
from ..secp256k1lab.bip340 import schnorr_verify
from ..secp256k1lab.keys import pubkey_gen_plain from ..secp256k1lab.keys import pubkey_gen_plain
from ..secp256k1lab.secp256k1 import G, GE, Scalar from ..secp256k1lab.secp256k1 import G, GE, Scalar
from ..secp256k1lab.util import bytes_from_int, int_from_bytes, tagged_hash from ..secp256k1lab.util import int_from_bytes, tagged_hash
PlainPk = NewType('PlainPk', bytes) PlainPk = NewType('PlainPk', bytes)
XonlyPk = NewType('XonlyPk', bytes) XonlyPk = NewType('XonlyPk', bytes)

4
test/jmclient/commontest.py

@ -5,9 +5,9 @@ import os
import random import random
from decimal import Decimal from decimal import Decimal
from typing import Callable, List, Optional, Set, Tuple, Union from typing import Callable, List, Optional, Set, Tuple, Union
from unittest import IsolatedAsyncioTestCase as AsyncioTestCase from unittest import IsolatedAsyncioTestCase as AsyncioTestCase # noqa: F401
from twisted.trial.unittest import TestCase as TrialTestCase from twisted.trial.unittest import TestCase as TrialTestCase # noqa: F401
import jmbitcoin as btc import jmbitcoin as btc
from jmbase import (get_log, hextobin, bintohex, dictchanger) from jmbase import (get_log, hextobin, bintohex, dictchanger)

4
test/jmclient/test_client_protocol.py

@ -8,7 +8,7 @@ import base64
import pytest import pytest
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
from jmbase import get_log, bintohex from jmbase import get_log, bintohex
@ -17,7 +17,7 @@ from jmclient import load_test_config, Taker,\
JMClientProtocolFactory, jm_single, Maker, WalletService JMClientProtocolFactory, jm_single, Maker, WalletService
from jmclient.client_protocol import JMTakerClientProtocol from jmclient.client_protocol import JMTakerClientProtocol
from twisted.python.log import msg as tmsg from twisted.python.log import msg as tmsg
from twisted.internet import protocol, reactor, task from twisted.internet import protocol, task
from twisted.internet.defer import inlineCallbacks from twisted.internet.defer import inlineCallbacks
from twisted.internet.error import (ConnectionLost, ConnectionAborted, from twisted.internet.error import (ConnectionLost, ConnectionAborted,
ConnectionClosed, ConnectionDone) ConnectionClosed, ConnectionDone)

2
test/jmclient/test_coinjoin.py

@ -13,7 +13,7 @@ from unittest import IsolatedAsyncioTestCase
from unittest_parametrize import parametrize, ParametrizedTestCase from unittest_parametrize import parametrize, ParametrizedTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
import pytest import pytest

3
test/jmclient/test_core_nohistory_sync.py

@ -7,8 +7,7 @@ from unittest import IsolatedAsyncioTestCase
from unittest_parametrize import parametrize, ParametrizedTestCase from unittest_parametrize import parametrize, ParametrizedTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
import pytest import pytest
from jmbase import get_log from jmbase import get_log

5
test/jmclient/test_frost_clients.py

@ -1,12 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from pprint import pprint
from hashlib import sha256 from hashlib import sha256
from unittest import IsolatedAsyncioTestCase from unittest import IsolatedAsyncioTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
import pytest import pytest

11
test/jmclient/test_frost_ipc.py

@ -1,14 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import asyncio import asyncio
import base64
import time import time
from pprint import pprint
from unittest import IsolatedAsyncioTestCase from unittest import IsolatedAsyncioTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
import pytest import pytest
@ -48,7 +45,7 @@ class DummyFrostJMClientProtocol:
self.party_clients = {} self.party_clients = {}
async def dkg_gen(self): async def dkg_gen(self):
log.debug(f'Coordinator call dkg_gen') log.debug('Coordinator call dkg_gen')
client = self.factory.client client = self.factory.client
md_type_idx = None md_type_idx = None
session_id = None session_id = None
@ -167,11 +164,11 @@ class DummyFrostJMClientProtocol:
async def on_dkg_finalized(self, nick, session_id): async def on_dkg_finalized(self, nick, session_id):
client = self.factory.client client = self.factory.client
log.debug(f'Coordinator get dkgfinalized') log.debug('Coordinator get dkgfinalized')
client.on_dkg_finalized(nick, session_id) client.on_dkg_finalized(nick, session_id)
def frost_req(self, dkg_session_id, msg_bytes): def frost_req(self, dkg_session_id, msg_bytes):
log.debug(f'Coordinator call frost_req') log.debug('Coordinator call frost_req')
client = self.factory.client client = self.factory.client
hostpubkeyhash, sig, session_id = client.frost_req( hostpubkeyhash, sig, session_id = client.frost_req(
dkg_session_id, msg_bytes) dkg_session_id, msg_bytes)

4
test/jmclient/test_frost_wallet.py

@ -1,14 +1,12 @@
'''Wallet functionality tests.''' '''Wallet functionality tests.'''
import os import os
import json import json
from pprint import pprint
from unittest import IsolatedAsyncioTestCase from unittest import IsolatedAsyncioTestCase
from fastbencode import bdecode from fastbencode import bdecode
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
import pytest import pytest
import jmbitcoin as btc import jmbitcoin as btc

5
test/jmclient/test_maker.py

@ -2,20 +2,17 @@ import datetime
from unittest import IsolatedAsyncioTestCase from unittest import IsolatedAsyncioTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
import jmbitcoin as btc import jmbitcoin as btc
from jmclient import Maker, load_test_config, jm_single, WalletService, VolatileStorage, \ from jmclient import Maker, load_test_config, jm_single, WalletService, VolatileStorage, \
SegwitWalletFidelityBonds, get_network SegwitWalletFidelityBonds, get_network
import jmclient
from commontest import DummyBlockchainInterface from commontest import DummyBlockchainInterface
from test_taker import DummyWallet from test_taker import DummyWallet
import struct import struct
import binascii import binascii
from itertools import chain from itertools import chain
import pytest
from _pytest.monkeypatch import MonkeyPatch from _pytest.monkeypatch import MonkeyPatch

3
test/jmclient/test_psbt_wallet.py

@ -12,8 +12,7 @@ from unittest import IsolatedAsyncioTestCase
from unittest_parametrize import parametrize, ParametrizedTestCase from unittest_parametrize import parametrize, ParametrizedTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
from commontest import make_wallets, dummy_accept_callback, dummy_info_callback from commontest import make_wallets, dummy_accept_callback, dummy_info_callback

3
test/jmclient/test_snicker.py

@ -7,8 +7,7 @@ from unittest import IsolatedAsyncioTestCase
from unittest_parametrize import parametrize, ParametrizedTestCase from unittest_parametrize import parametrize, ParametrizedTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
from commontest import make_wallets, dummy_accept_callback, dummy_info_callback from commontest import make_wallets, dummy_accept_callback, dummy_info_callback
import jmbitcoin as btc import jmbitcoin as btc

3
test/jmclient/test_taker.py

@ -12,8 +12,7 @@ from unittest import IsolatedAsyncioTestCase
from unittest_parametrize import parametrize, ParametrizedTestCase from unittest_parametrize import parametrize, ParametrizedTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
from commontest import DummyBlockchainInterface from commontest import DummyBlockchainInterface
import jmbitcoin as bitcoin import jmbitcoin as bitcoin

3
test/jmclient/test_taproot_wallet.py

@ -9,8 +9,7 @@ from unittest import IsolatedAsyncioTestCase
from unittest_parametrize import parametrize, ParametrizedTestCase from unittest_parametrize import parametrize, ParametrizedTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
import pytest import pytest
from _pytest.monkeypatch import MonkeyPatch from _pytest.monkeypatch import MonkeyPatch

3
test/jmclient/test_tx_creation.py

@ -9,8 +9,7 @@ import pytest
import struct import struct
from unittest import IsolatedAsyncioTestCase from unittest import IsolatedAsyncioTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
from commontest import make_wallets, make_sign_and_push, ensure_bip65_activated from commontest import make_wallets, make_sign_and_push, ensure_bip65_activated

5
test/jmclient/test_utxomanager.py

@ -1,15 +1,12 @@
from test_storage import MockStorage from test_storage import MockStorage
import pytest
from _pytest.monkeypatch import MonkeyPatch from _pytest.monkeypatch import MonkeyPatch
from unittest import IsolatedAsyncioTestCase from unittest import IsolatedAsyncioTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
from jmclient.wallet import UTXOManager from jmclient.wallet import UTXOManager
from jmclient import load_test_config from jmclient import load_test_config
import jmclient
from commontest import DummyBlockchainInterface from commontest import DummyBlockchainInterface

5
test/jmclient/test_wallet.py

@ -8,8 +8,7 @@ from unittest import IsolatedAsyncioTestCase
from unittest_parametrize import parametrize, ParametrizedTestCase from unittest_parametrize import parametrize, ParametrizedTestCase
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor
import pytest import pytest
from _pytest.monkeypatch import MonkeyPatch from _pytest.monkeypatch import MonkeyPatch
@ -22,7 +21,7 @@ from jmclient import load_test_config, jm_single, BaseWallet, \
SegwitWallet, WalletService, SegwitWalletFidelityBonds,\ SegwitWallet, WalletService, SegwitWalletFidelityBonds,\
create_wallet, open_test_wallet_maybe, open_wallet, \ create_wallet, open_test_wallet_maybe, open_wallet, \
FidelityBondMixin, FidelityBondWatchonlyWallet,\ FidelityBondMixin, FidelityBondWatchonlyWallet,\
wallet_gettimelockaddress, UnknownAddressForLabel, TaprootWallet wallet_gettimelockaddress, UnknownAddressForLabel
from test_blockchaininterface import sync_test_wallet from test_blockchaininterface import sync_test_wallet
from freezegun import freeze_time from freezegun import freeze_time

2
test/jmclient/test_wallet_rpc.py

@ -4,7 +4,7 @@ import functools
import json import json
import os import os
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor from twisted.internet import reactor
import jwt import jwt

2
test/jmclient/test_websocket.py

@ -1,7 +1,7 @@
import os import os
import json import json
from twisted.internet import reactor, task from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, Deferred from twisted.internet.defer import inlineCallbacks, Deferred
from twisted.trial import unittest from twisted.trial import unittest
from autobahn.twisted.websocket import WebSocketClientFactory, \ from autobahn.twisted.websocket import WebSocketClientFactory, \

3
test/jmclient/test_yieldgenerator.py

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
import unittest
import pytest import pytest
from jmbitcoin import CMutableTxOut, CMutableTransaction from jmbitcoin import CMutableTxOut, CMutableTransaction

1
test/jmfrost/test_frost_ref.py

@ -3,7 +3,6 @@
import json import json
import os import os
import secrets import secrets
import sys
import time import time
from typing import List, Optional, Tuple from typing import List, Optional, Tuple

4
test/unified/common.py

@ -10,8 +10,8 @@ from decimal import Decimal
data_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) data_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0, os.path.join(data_dir)) sys.path.insert(0, os.path.join(data_dir))
from unittest import IsolatedAsyncioTestCase as AsyncioTestCase from unittest import IsolatedAsyncioTestCase as AsyncioTestCase # noqa: F401
from twisted.trial.unittest import TestCase as TrialTestCase from twisted.trial.unittest import TestCase as TrialTestCase # noqa: F401
from jmbase import get_log from jmbase import get_log
from jmclient import open_test_wallet_maybe, BIP32Wallet, SegwitWallet, \ from jmclient import open_test_wallet_maybe, BIP32Wallet, SegwitWallet, \

8
test/unified/test_e2e_coinjoin.py

@ -16,8 +16,8 @@
import asyncio import asyncio
import jmclient # install asyncioreactor import jmclient # noqa: F401 install asyncioreactor
from twisted.internet import reactor, defer, task from twisted.internet import reactor, defer
from twisted.web.client import readBody, Headers from twisted.web.client import readBody, Headers
from twisted import trial from twisted import trial
@ -26,12 +26,10 @@ import pytest
import json import json
from datetime import datetime from datetime import datetime
from _pytest.monkeypatch import MonkeyPatch from _pytest.monkeypatch import MonkeyPatch
from jmbase import (get_nontor_agent, BytesProducer, jmprint, from jmbase import get_nontor_agent, BytesProducer, jmprint, get_log
get_log, stop_reactor)
from jmclient import (YieldGeneratorBasic, load_test_config, jm_single, from jmclient import (YieldGeneratorBasic, load_test_config, jm_single,
JMClientProtocolFactory, start_reactor, SegwitWallet, get_mchannels, JMClientProtocolFactory, start_reactor, SegwitWallet, get_mchannels,
SegwitLegacyWallet, JMWalletDaemon) SegwitLegacyWallet, JMWalletDaemon)
import jmclient
from jmclient.wallet_rpc import api_version_string from jmclient.wallet_rpc import api_version_string
pytestmark = pytest.mark.usefixtures("setup_miniircd", "setup_regtest_bitcoind") pytestmark = pytest.mark.usefixtures("setup_miniircd", "setup_regtest_bitcoind")

Loading…
Cancel
Save