forked from Kieran/snort
bug: catch invalid invoice
This commit is contained in:
parent
7a2ba299cb
commit
f34e42701f
@ -27,12 +27,17 @@ function getInvoice(zap: TaggedRawEvent) {
|
|||||||
console.debug("Invalid zap: ", zap);
|
console.debug("Invalid zap: ", zap);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const decoded = invoiceDecode(bolt11);
|
try {
|
||||||
|
const decoded = invoiceDecode(bolt11);
|
||||||
|
|
||||||
const amount = decoded.sections.find(section => section.name === "amount")?.value;
|
const amount = decoded.sections.find(section => section.name === "amount")?.value;
|
||||||
const hash = decoded.sections.find(section => section.name === "description_hash")?.value;
|
const hash = decoded.sections.find(section => section.name === "description_hash")?.value;
|
||||||
|
|
||||||
return { amount, hash: hash ? bytesToHex(hash as Uint8Array) : undefined };
|
return { amount, hash: hash ? bytesToHex(hash as Uint8Array) : undefined };
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Zapper {
|
interface Zapper {
|
||||||
|
Loading…
Reference in New Issue
Block a user