mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-04-09 12:28:23 +02:00
optimizations top zaps
This commit is contained in:
parent
9def17c777
commit
c078203c8c
@ -135,25 +135,50 @@ class DicoverContentCurrentlyPopularZaps(DVMTaskInterface):
|
||||
filt = Filter().kinds([definitions.EventDefinitions.KIND_ZAP]).event(event.id()).since(since)
|
||||
zaps = await database.query([filt])
|
||||
invoice_amount = 0
|
||||
|
||||
event_author = event.author().to_hex()
|
||||
if len(zaps) >= self.min_reactions:
|
||||
has_preimage = False
|
||||
has_amount = False
|
||||
overall_amount = 0
|
||||
for zap in zaps:
|
||||
if event.author().to_hex() == zap.author().to_hex():
|
||||
if event_author == zap.author().to_hex():
|
||||
continue #Skip self zaps..
|
||||
invoice_amount = 0
|
||||
for tag in zap.tags():
|
||||
# print(tag.as_vec())
|
||||
|
||||
if tag.as_vec()[0] == 'bolt11':
|
||||
# print(tag.as_vec()[1])
|
||||
invoice_amount = parse_amount_from_bolt11_invoice(tag.as_vec()[1])
|
||||
|
||||
has_amount = True
|
||||
if has_preimage:
|
||||
break
|
||||
# print(invoice_amount)
|
||||
if tag.as_vec()[0] == 'preimage':
|
||||
if len(tag.as_vec()) > 1:
|
||||
if tag.as_vec()[1] != "":
|
||||
overall_amount += invoice_amount
|
||||
if tag.as_vec()[1] == "":
|
||||
continue
|
||||
elif tag.as_vec()[1] != "":
|
||||
|
||||
has_preimage = True # TODO further check preimage
|
||||
if has_amount:
|
||||
overall_amount += invoice_amount
|
||||
break
|
||||
#elif tag.as_vec()[0] == 'description':
|
||||
# try:
|
||||
# event = Event.from_json(tag.as_vec()[1])
|
||||
# for tag in event.tags():
|
||||
# if tag.as_vec()[0] == "amount":
|
||||
# invoice_amount = tag.as_vec()[1]
|
||||
# overall_amount += invoice_amount
|
||||
|
||||
# has_amount = True
|
||||
# if has_preimage:
|
||||
# break
|
||||
|
||||
# except:
|
||||
# pass
|
||||
|
||||
if has_preimage:
|
||||
ns.finallist[event.id().to_hex()] = overall_amount
|
||||
|
||||
|
@ -32,7 +32,7 @@ use_logger = True
|
||||
AVOID_PAID_OUTBOX_RELAY_LIST = ["wss://nostrelay.yeghro.site", "wss://nostr.wine", "wss://filter.nostr.wine"
|
||||
"wss://nostr21.com", "wss://nostr.bitcoiner.social", "wss://nostr.orangepill.dev",
|
||||
"wss://relay.lnpay.me", "wss://relay.snort.social", "wss://relay.minds.com/nostr/v1/ws",
|
||||
"wss://nostr-pub.semisol.dev", "wss://mostr.pub", "wss://relay.mostr.pub", "wss://minds.com",
|
||||
"wss://nostr-pub.semisol.dev", "wss://mostr.mostr.pub", "wss://relay.mostr.pub", "wss://minds.com",
|
||||
"wss://yabu.me", "wss://relay.yozora.world", "wss://filter.nostr.wine/?global=all", "wss://eden.nostr.land",
|
||||
"wss://relay.orangepill.ovh", "wss://nostr.jcloud.es", "wss://af.purplerelay.com", "wss://za.purplerelay.com",
|
||||
"wss://relay.nostrich.land", "wss://relay.nostrplebs.com", "wss://relay.nostrich.land",
|
||||
@ -416,7 +416,7 @@ def playground():
|
||||
|
||||
options_top_zapped = {
|
||||
"db_name": "db/nostr_recent_notes.db",
|
||||
"db_since": 60 * 60 * 8, # 8h since gmt,
|
||||
"db_since": 60 * 60 * 6, # 8h since gmt,
|
||||
}
|
||||
cost = 0
|
||||
image = "https://image.nostr.build/c6879f458252641d04d0aa65fd7f1e005a4f7362fd407467306edc2f4acdb113.jpg"
|
||||
|
Loading…
x
Reference in New Issue
Block a user