bitcoinjs / bolt11

A library for encoding and decoding lightning network payment requests as defined in BOLT #11.
MIT License
93 stars 65 forks source link

Fix: Skip unknown tagged fields #15

Closed cavanmflynn closed 5 years ago

cavanmflynn commented 5 years ago

According to the bolt 11 spec, a reader should skip unknown tagged fields.

Relevant section

A reader:

MUST skip over unknown fields, OR an f field with unknown version, OR p, h, or n fields that do NOT have data_lengths of 52, 52, or 53, respectively.

Currently, the decode function will throw with parser is not a function if a payment request contains an unknown tagged field. This PR skips over the field if no name or parser is found.

junderw commented 5 years ago

Made alternative fix at #16 let me know if this will be sufficient.

cavanmflynn commented 5 years ago

@junderw Looks good! Thanks for the quick update!

cavanmflynn commented 5 years ago

Closing in favor of #16