mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-20 13:28:20 +02:00
Remove received payments verifier (#591)
* Got received payments working without verifier class * Process received payments works with better exception handling * Delete sent offers verifier
This commit is contained in:
parent
f63c511149
commit
080ee1eac8
3 changed files with 38 additions and 71 deletions
|
|
@ -1,37 +0,0 @@
|
|||
import logging
|
||||
|
||||
from squeaknode.core.sent_offer import SentOffer
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
LND_CONNECT_RETRY_S = 10
|
||||
|
||||
|
||||
class SentOffersVerifier:
|
||||
def __init__(self, squeak_db, squeak_core):
|
||||
self.squeak_db = squeak_db
|
||||
self.squeak_core = squeak_core
|
||||
|
||||
def process_subscribed_invoices(self):
|
||||
while True:
|
||||
self.try_processing()
|
||||
|
||||
def try_processing(self):
|
||||
latest_settle_index = self._get_latest_settle_index() or 0
|
||||
|
||||
def get_sent_offer_for_payment_hash(payment_hash: bytes) -> SentOffer:
|
||||
return self.squeak_db.get_sent_offer_by_payment_hash(
|
||||
payment_hash
|
||||
)
|
||||
|
||||
for received_payment in self.squeak_core.get_received_payments(
|
||||
get_sent_offer_for_payment_hash,
|
||||
latest_settle_index,
|
||||
LND_CONNECT_RETRY_S,
|
||||
):
|
||||
self.squeak_db.insert_received_payment(received_payment)
|
||||
|
||||
def _get_latest_settle_index(self):
|
||||
logger.info("Getting latest settle index from db...")
|
||||
return self.squeak_db.get_latest_settle_index()
|
||||
Loading…
Add table
Add a link
Reference in a new issue