reorganize with_lock decorator
This commit is contained in:
@@ -3,7 +3,7 @@ from typing import Optional, Sequence, Tuple, List, Dict, TYPE_CHECKING, Set
|
||||
import threading
|
||||
|
||||
from .lnutil import SENT, RECEIVED, LOCAL, REMOTE, HTLCOwner, UpdateAddHtlc, Direction, FeeUpdate
|
||||
from .util import bh2u, bfh
|
||||
from .util import bh2u, bfh, with_lock
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .json_db import StoredDict
|
||||
@@ -50,12 +50,6 @@ class HTLCManager:
|
||||
|
||||
self._init_maybe_active_htlc_ids()
|
||||
|
||||
def with_lock(func):
|
||||
def func_wrapper(self, *args, **kwargs):
|
||||
with self.lock:
|
||||
return func(self, *args, **kwargs)
|
||||
return func_wrapper
|
||||
|
||||
@with_lock
|
||||
def ctn_latest(self, sub: HTLCOwner) -> int:
|
||||
"""Return the ctn for the latest (newest that has a valid sig) ctx of sub"""
|
||||
|
||||
Reference in New Issue
Block a user