blocks: pass keypair instead of privkey to avoid pubkey gen

Generating a pubkey is quite slow, so pass a keypair instead of privkey
This commit is contained in:
William Casarin
2023-08-28 11:46:03 -07:00
parent 8e92e28faf
commit c71b0ee916
24 changed files with 108 additions and 107 deletions

View File

@@ -928,8 +928,8 @@ func validate_event(ev: NostrEvent) -> ValidationResult {
return ok ? .ok : .bad_sig
}
func first_eref_mention(ev: NostrEvent, privkey: Privkey?) -> Mention<NoteId>? {
let blocks = ev.blocks(privkey).blocks.filter { block in
func first_eref_mention(ev: NostrEvent, keypair: Keypair) -> Mention<NoteId>? {
let blocks = ev.blocks(keypair).blocks.filter { block in
guard case .mention(let mention) = block,
case .note = mention.ref else {
return false