1
0

reorganize with_lock decorator

This commit is contained in:
bitromortac
2021-03-22 08:25:26 +01:00
parent 92226b077a
commit 63308f94a0
4 changed files with 13 additions and 23 deletions

View File

@@ -32,7 +32,7 @@ from aiorpcx import TaskGroup
from . import bitcoin, util
from .bitcoin import COINBASE_MATURITY
from .util import profiler, bfh, TxMinedInfo, UnrelatedTransactionException
from .util import profiler, bfh, TxMinedInfo, UnrelatedTransactionException, with_lock
from .transaction import Transaction, TxOutput, TxInput, PartialTxInput, TxOutpoint, PartialTransaction
from .synchronizer import Synchronizer
from .verifier import SPV
@@ -98,12 +98,6 @@ class AddressSynchronizer(Logger):
self.load_and_cleanup()
def with_lock(func):
def func_wrapper(self: 'AddressSynchronizer', *args, **kwargs):
with self.lock:
return func(self, *args, **kwargs)
return func_wrapper
def with_transaction_lock(func):
def func_wrapper(self: 'AddressSynchronizer', *args, **kwargs):
with self.transaction_lock: