1
0

Move callback manager out of Network class

This commit is contained in:
ThomasV
2020-04-14 16:12:47 +02:00
parent 73325831b7
commit 9224404108
19 changed files with 146 additions and 129 deletions

View File

@@ -30,6 +30,7 @@ import logging
from aiorpcx import TaskGroup, run_in_thread, RPCError
from . import util
from .transaction import Transaction, PartialTransaction
from .util import bh2u, make_aiohttp_session, NetworkJobOnDefaultServer
from .bitcoin import address_to_scripthash, is_address
@@ -227,7 +228,7 @@ class Synchronizer(SynchronizerBase):
self.wallet.receive_tx_callback(tx_hash, tx, tx_height)
self.logger.info(f"received tx {tx_hash} height: {tx_height} bytes: {len(raw_tx)}")
# callbacks
self.wallet.network.trigger_callback('new_transaction', self.wallet, tx)
util.trigger_callback('new_transaction', self.wallet, tx)
async def main(self):
self.wallet.set_up_to_date(False)
@@ -252,7 +253,7 @@ class Synchronizer(SynchronizerBase):
if up_to_date:
self._reset_request_counters()
self.wallet.set_up_to_date(up_to_date)
self.wallet.network.trigger_callback('wallet_updated', self.wallet)
util.trigger_callback('wallet_updated', self.wallet)
class Notifier(SynchronizerBase):