mirror of
https://github.com/aljazceru/hypergolic.git
synced 2025-12-17 05:24:21 +01:00
problem: we are querying zappers too often
This commit is contained in:
@@ -6,7 +6,7 @@ import { sha256 } from 'js-sha256';
|
|||||||
import { MapOfVotes, MeritRequest, Votes } from './merits';
|
import { MapOfVotes, MeritRequest, Votes } from './merits';
|
||||||
import * as immutable from 'immutable';
|
import * as immutable from 'immutable';
|
||||||
import { BloomFilter } from 'bloomfilter';
|
import { BloomFilter } from 'bloomfilter';
|
||||||
import { zappers } from '@/stores/zappers';
|
import { attempts, zappers } from '@/stores/zappers';
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
export class Rocket {
|
export class Rocket {
|
||||||
@@ -744,7 +744,11 @@ export async function ValidateZapPublisher(rocket: NDKEvent, zap: NDKEvent): Pro
|
|||||||
let zapper = get(zappers).get(rocket.pubkey);
|
let zapper = get(zappers).get(rocket.pubkey);
|
||||||
if (zapper && zapper == zap.pubkey) {
|
if (zapper && zapper == zap.pubkey) {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
} else {
|
} else if (!get(attempts).has(rocket.pubkey)) {
|
||||||
|
attempts.update((existing) => {
|
||||||
|
existing.add(rocket.pubkey);
|
||||||
|
return existing;
|
||||||
|
});
|
||||||
getAuthorizedZapper(rocket)
|
getAuthorizedZapper(rocket)
|
||||||
.then((pubkey) => {
|
.then((pubkey) => {
|
||||||
if (pubkey == zap.pubkey) {
|
if (pubkey == zap.pubkey) {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export let zappers = writable(new Map<string, string>());
|
export let zappers = writable(new Map<string, string>());
|
||||||
|
|
||||||
|
export let attempts = writable(new Set<string>());
|
||||||
|
|||||||
Reference in New Issue
Block a user