Browse Source

replace some erroneous usages of IntFlag with IntEnum

patch-4
SomberNight 3 years ago
parent
commit
1b6706bed6
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/lnonion.py
  2. 5
      electrum/lnutil.py
  3. 4
      electrum/lnworker.py

2
electrum/lnonion.py

@ -26,7 +26,7 @@
import io import io
import hashlib import hashlib
from typing import Sequence, List, Tuple, NamedTuple, TYPE_CHECKING, Dict, Any, Optional 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 . import ecc
from .crypto import sha256, hmac_oneshot, chacha20_encrypt from .crypto import sha256, hmac_oneshot, chacha20_encrypt

5
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 c_input._trusted_value_sats = funding_sat
return c_input return c_input
class HTLCOwner(IntFlag):
class HTLCOwner(IntEnum):
LOCAL = 1 LOCAL = 1
REMOTE = -LOCAL REMOTE = -LOCAL
@ -832,7 +833,7 @@ class HTLCOwner(IntFlag):
return HTLCOwner(super().__neg__()) return HTLCOwner(super().__neg__())
class Direction(IntFlag): class Direction(IntEnum):
SENT = -1 # in the context of HTLCs: "offered" HTLCs SENT = -1 # in the context of HTLCs: "offered" HTLCs
RECEIVED = 1 # in the context of HTLCs: "received" HTLCs RECEIVED = 1 # in the context of HTLCs: "received" HTLCs

4
electrum/lnworker.py

@ -8,7 +8,7 @@ from decimal import Decimal
import random import random
import time import time
import operator import operator
from enum import IntFlag from enum import IntEnum
from typing import (Optional, Sequence, Tuple, List, Set, Dict, TYPE_CHECKING, from typing import (Optional, Sequence, Tuple, List, Set, Dict, TYPE_CHECKING,
NamedTuple, Union, Mapping, Any, Iterable, AsyncGenerator, DefaultDict) NamedTuple, Union, Mapping, Any, Iterable, AsyncGenerator, DefaultDict)
import threading import threading
@ -152,7 +152,7 @@ FALLBACK_NODE_LIST_MAINNET = [
from .trampoline import trampolines_by_id, hardcoded_trampoline_nodes, is_hardcoded_trampoline from .trampoline import trampolines_by_id, hardcoded_trampoline_nodes, is_hardcoded_trampoline
class PaymentDirection(IntFlag): class PaymentDirection(IntEnum):
SENT = 0 SENT = 0
RECEIVED = 1 RECEIVED = 1
SELF_PAYMENT = 2 SELF_PAYMENT = 2

Loading…
Cancel
Save