WASM: PoW

This commit is contained in:
2023-09-24 21:28:39 +01:00
parent 9f731da5be
commit 6e7a28a42b
19 changed files with 1146 additions and 52 deletions

View File

@ -3,7 +3,7 @@ import { EventKind, NostrPrefix, encodeTLVEntries, TLVEntryType, TLVEntry, decod
import { GiftWrapCache } from "Cache/GiftWrapCache";
import { UnwrappedGift } from "Db";
import { Chat, ChatSystem, ChatType, lastReadInChat } from "chat";
import { DefaultPowWorker } from "index";
import { WasmPowWorker } from "index";
export class Nip24ChatSystem extends ExternalStore<Array<Chat>> implements ChatSystem {
#cache: GiftWrapCache;
@ -105,7 +105,9 @@ export class Nip24ChatSystem extends ExternalStore<Array<Chat>> implements ChatS
const recvSealedN = pub.giftWrap(await pub.sealRumor(gossip, pt.id), pt.id, powTarget);
messages.push(recvSealedN);
}
messages.push(pub.giftWrap(await pub.sealRumor(gossip, pub.pubKey), pub.pubKey, powTarget, DefaultPowWorker));
messages.push(
pub.giftWrap(await pub.sealRumor(gossip, pub.pubKey), pub.pubKey, powTarget, new WasmPowWorker()),
);
return await Promise.all(messages);
},
sendMessage: (ev, system) => {