1
0

Persist LNWatcher transactions in wallet file:

- separate AddressSynchronizer from Wallet and LNWatcher
 - the AddressSynchronizer class is referred to as 'adb' (address database)
 - Use callbacks to replace overloaded methods
This commit is contained in:
ThomasV
2022-06-01 23:03:35 +02:00
parent b6de15b95d
commit 121d8732f1
23 changed files with 439 additions and 366 deletions

View File

@@ -24,7 +24,8 @@ from . import ElectrumTestCase
class FakeSynchronizer(object):
def __init__(self):
def __init__(self, db):
self.db = db
self.store = []
def add(self, address):
@@ -100,18 +101,20 @@ class FakeFxThread:
ccy_amount_str = FxThread.ccy_amount_str
history_rate = FxThread.history_rate
class FakeADB:
def get_tx_height(self, txid):
# because we use a current timestamp, and history is empty,
# FxThread.history_rate will use spot prices
return TxMinedInfo(height=10, conf=10, timestamp=int(time.time()), header_hash='def')
class FakeWallet:
def __init__(self, fiat_value):
super().__init__()
self.fiat_value = fiat_value
self.db = WalletDB("{}", manual_upgrades=True)
self.adb = FakeADB()
self.db.transactions = self.db.verified_tx = {'abc':'Tx'}
def get_tx_height(self, txid):
# because we use a current timestamp, and history is empty,
# FxThread.history_rate will use spot prices
return TxMinedInfo(height=10, conf=10, timestamp=int(time.time()), header_hash='def')
default_fiat_value = Abstract_Wallet.default_fiat_value
price_at_timestamp = Abstract_Wallet.price_at_timestamp
class storage: