From 1b6706bed6f8db8afd958a25bf91e154a19f909e Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 29 Jun 2022 18:07:03 +0200 Subject: [PATCH] replace some erroneous usages of IntFlag with IntEnum --- electrum/lnonion.py | 2 +- electrum/lnutil.py | 5 +++-- electrum/lnworker.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/electrum/lnonion.py b/electrum/lnonion.py index 169417cc4..cbf7ca2fd 100644 --- a/electrum/lnonion.py +++ b/electrum/lnonion.py @@ -26,7 +26,7 @@ import io import hashlib from typing import Sequence, List, Tuple, NamedTuple, TYPE_CHECKING, Dict, Any, Optional -from enum import IntEnum, IntFlag +from enum import IntEnum from . import ecc from .crypto import sha256, hmac_oneshot, chacha20_encrypt diff --git a/electrum/lnutil.py b/electrum/lnutil.py index 75a879872..5b63f7790 100644 --- a/electrum/lnutil.py +++ b/electrum/lnutil.py @@ -821,7 +821,8 @@ def make_funding_input(local_funding_pubkey: bytes, remote_funding_pubkey: bytes c_input._trusted_value_sats = funding_sat return c_input -class HTLCOwner(IntFlag): + +class HTLCOwner(IntEnum): LOCAL = 1 REMOTE = -LOCAL @@ -832,7 +833,7 @@ class HTLCOwner(IntFlag): return HTLCOwner(super().__neg__()) -class Direction(IntFlag): +class Direction(IntEnum): SENT = -1 # in the context of HTLCs: "offered" HTLCs RECEIVED = 1 # in the context of HTLCs: "received" HTLCs diff --git a/electrum/lnworker.py b/electrum/lnworker.py index af970eeef..7f8c02029 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -8,7 +8,7 @@ from decimal import Decimal import random import time import operator -from enum import IntFlag +from enum import IntEnum from typing import (Optional, Sequence, Tuple, List, Set, Dict, TYPE_CHECKING, NamedTuple, Union, Mapping, Any, Iterable, AsyncGenerator, DefaultDict) import threading @@ -152,7 +152,7 @@ FALLBACK_NODE_LIST_MAINNET = [ from .trampoline import trampolines_by_id, hardcoded_trampoline_nodes, is_hardcoded_trampoline -class PaymentDirection(IntFlag): +class PaymentDirection(IntEnum): SENT = 0 RECEIVED = 1 SELF_PAYMENT = 2