mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-17 13:07:32 +02:00
parent
04e8cf3ded
commit
0c136a3b80
4 changed files with 4 additions and 52 deletions
|
|
@ -35,9 +35,7 @@ DEFAULT_LND_RPC_PORT = 10009
|
|||
DEFAULT_SQK_DIR = ".sqk"
|
||||
DEFAULT_SQK_DIR_PATH = str(Path.home() / DEFAULT_SQK_DIR)
|
||||
DEFAULT_LND_HOST = "localhost"
|
||||
DEFAULT_SYNC_INTERVAL_S = 10
|
||||
DEFAULT_SYNC_TIMEOUT_S = 10
|
||||
DEFAULT_SYNC_BLOCK_INTERVAL = 2016
|
||||
DEFAULT_INTEREST_BLOCK_INTERVAL = 2016
|
||||
DEFAULT_SENT_OFFER_RETENTION_S = 86400
|
||||
DEFAULT_OFFER_DELETION_INTERVAL_S = 10
|
||||
DEFAULT_SUBSCRIBE_INVOICES_RETRY_S = 10
|
||||
|
|
@ -111,15 +109,8 @@ class CoreConfig(Config):
|
|||
cast=int, required=False, default=DEFAULT_SQUEAK_DELETION_INTERVAL_S)
|
||||
offer_deletion_interval_s = key(
|
||||
cast=int, required=False, default=DEFAULT_OFFER_DELETION_INTERVAL_S)
|
||||
|
||||
|
||||
@section('sync')
|
||||
class SyncConfig(Config):
|
||||
enabled = key(cast=bool, required=False, default=True)
|
||||
interval_s = key(cast=int, required=False, default=DEFAULT_SYNC_INTERVAL_S)
|
||||
timeout_s = key(cast=float, required=False, default=DEFAULT_SYNC_TIMEOUT_S)
|
||||
block_interval = key(cast=int, required=False,
|
||||
default=DEFAULT_SYNC_BLOCK_INTERVAL)
|
||||
interest_block_interval = key(cast=int, required=False,
|
||||
default=DEFAULT_INTEREST_BLOCK_INTERVAL)
|
||||
|
||||
|
||||
@section('db')
|
||||
|
|
@ -134,7 +125,6 @@ class SqueaknodeConfig(Config):
|
|||
admin = group_key(AdminConfig)
|
||||
webadmin = group_key(WebadminConfig)
|
||||
core = group_key(CoreConfig)
|
||||
sync = group_key(SyncConfig)
|
||||
db = group_key(DbConfig)
|
||||
# description = key(cast=str, section_name="general")
|
||||
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ class SqueakController:
|
|||
|
||||
def get_block_range(self) -> BlockRange:
|
||||
max_block = self.squeak_core.get_best_block_height()
|
||||
block_interval = self.config.sync.block_interval
|
||||
block_interval = self.config.core.interest_block_interval
|
||||
min_block = max(0, max_block - block_interval)
|
||||
return BlockRange(min_block, max_block)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ from squeaknode.node.process_received_payments_worker import ProcessReceivedPaym
|
|||
from squeaknode.node.squeak_controller import SqueakController
|
||||
from squeaknode.node.squeak_deletion_worker import SqueakDeletionWorker
|
||||
from squeaknode.node.squeak_offer_expiry_worker import SqueakOfferExpiryWorker
|
||||
from squeaknode.node.squeak_peer_sync_worker import SqueakPeerSyncWorker
|
||||
from squeaknode.node.squeak_rate_limiter import SqueakRateLimiter
|
||||
|
||||
|
||||
|
|
@ -51,7 +50,6 @@ class SqueakNode:
|
|||
self.initialize_admin_web_server()
|
||||
self.initialize_received_payment_processor_worker()
|
||||
self.initialize_peer_connection_worker()
|
||||
self.initialize_peer_sync_worker()
|
||||
self.initialize_squeak_deletion_worker()
|
||||
self.initialize_offer_expiry_worker()
|
||||
self.initialize_new_squeak_worker()
|
||||
|
|
@ -66,9 +64,6 @@ class SqueakNode:
|
|||
self.admin_web_server.start()
|
||||
self.received_payment_processor_worker.start_running()
|
||||
self.peer_connection_worker.start()
|
||||
# TODO: Delete peer_sync_worker, subscribe replaces it
|
||||
# if self.config.sync.enabled:
|
||||
# self.peer_sync_worker.start()
|
||||
self.squeak_deletion_worker.start()
|
||||
self.offer_expiry_worker.start()
|
||||
self.new_squeak_worker.start_running()
|
||||
|
|
@ -184,12 +179,6 @@ class SqueakNode:
|
|||
10,
|
||||
)
|
||||
|
||||
def initialize_peer_sync_worker(self):
|
||||
self.peer_sync_worker = SqueakPeerSyncWorker(
|
||||
self.squeak_controller,
|
||||
10,
|
||||
)
|
||||
|
||||
def initialize_squeak_deletion_worker(self):
|
||||
self.squeak_deletion_worker = SqueakDeletionWorker(
|
||||
self.squeak_controller,
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
import logging
|
||||
|
||||
from squeaknode.node.periodic_worker import PeriodicWorker
|
||||
from squeaknode.node.squeak_controller import SqueakController
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SqueakPeerSyncWorker(PeriodicWorker):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
squeak_controller: SqueakController,
|
||||
sync_interval_s,
|
||||
):
|
||||
self.squeak_controller = squeak_controller
|
||||
self.sync_interval_s = sync_interval_s
|
||||
|
||||
def work_fn(self):
|
||||
self.squeak_controller.sync_timeline()
|
||||
|
||||
def get_interval_s(self):
|
||||
return self.sync_interval_s
|
||||
|
||||
def get_name(self):
|
||||
return "peer_sync_worker"
|
||||
Loading…
Add table
Add a link
Reference in a new issue