Skip to content

Fix bug of geting destination and add new ln invoice test vector from bolt11#10

Merged
kafaichoi merged 3 commits into
masterfrom
add-new-ln-invoice-test-vector-from-bolt11
May 18, 2020
Merged

Fix bug of geting destination and add new ln invoice test vector from bolt11#10
kafaichoi merged 3 commits into
masterfrom
add-new-ln-invoice-test-vector-from-bolt11

Conversation

@kafaichoi
Copy link
Copy Markdown
Contributor

  • return error tuple instead of crashing when decoding a ln invoice with sub msat in amount
  • new test vectors are copied from BOLT11 additional and negative tests lightning/bolts#736
  • fix bug of not ignoring n and h field when their length is not expected ones.(found this issue after adding test vector)
  • fix bug of missing destination when we can't get it from n field but able to recover it from signature(found this issue after adding test vector)

Ran test and lint in local. All passed.

kafaichoi added 2 commits May 16, 2020 22:11
return error tuple instead of crashing when decoding a ln invoice with
sub msat in amount

new test vectors are copied from lightning/bolts#736
Comment thread lib/lightning_network/invoice.ex Outdated
rounded_amount_msat_dec = D.round(amount_msat_dec)

{:ok, amount_msat}
case Decimal.equal?(rounded_amount_msat_dec, amount_msat_dec) do
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use Decimal instead of D?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it back to using D to be more consistent. Thanks!

…eld but it's able to recover it in signature recovery. ignore n and h field if data length is not valid
@kafaichoi kafaichoi force-pushed the add-new-ln-invoice-test-vector-from-bolt11 branch from fc0ae59 to 3f0334b Compare May 18, 2020 00:33
@kafaichoi kafaichoi merged commit 18916a2 into master May 18, 2020
@philipglazman philipglazman deleted the add-new-ln-invoice-test-vector-from-bolt11 branch December 2, 2020 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants