Open patrickReiis opened 2 months ago
Thank you. I'll leave this for @alexgleason to review.
I haven't had time to review thoroughly yet. But my first gut reaction is that adding a dependency just for zaps should be avoided.
I haven't had time to review thoroughly yet. But my first gut reaction is that adding a dependency just for zaps should be avoided.
One of the requirements to validate a zap receipt is by decoding the bolt11 and checking if it's amount matches with the amount in the zap request. The only way to decode is by using this dependency (that is part of this nbd-wtf organization) or by just copying and pasting the code of the dependency, which seems would make things uglier.
This implements the
Appendix F: Validating Zap Receipts
section.I could've added more tests but they would be too repetitive and I felt it wouldn't look good.
I added a new dependency but since it's a project inside the "nbd - open source bitcoin & lightning development" organization then I think it would not be a problem.
Validating zap requests is very useful for it's own sake, and also useful when someone needs to implement a zap counter, for example.
Most of the code uses
let
variables, I ended up not refactoring that because there's probably a reason behind it, in my code I ended up usingconst
and all the tests passed.