Commit Graph

11 Commits

Author SHA1 Message Date
Conner Fromknecht
2bf94fa409
zpay32/invoice: consolidate 32-byte array parsing and encoding logic
This commit also consolidates the existing code duplication in parsing
payment hashes and description hashes into a single, combined method for
parsing 32-byte values. A similar change is made for encoding 32-byte
values.

zpay32/invoice: consolidate 32-byte encoding logic
2019-12-05 07:58:55 -08:00
Matheus Degiovani
cf6ae06b30 zpay32: Add tests of checksum malleability
This adds tests for checksum malleability issue of bech32 strings as
used by LN invoices.
2019-11-26 17:09:35 -03:00
Joost Jager
2be1051fb6
zpay32: move HopHint and DefaultFinalCLTVDelta 2019-03-15 10:08:32 +01:00
Conner Fromknecht
1ded697e8d
multi: sort import paths with gofmt 2018-08-02 18:20:49 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Wilmer Paulino
ea9e609ef0
zpay32: modify an invoice's r field to allow multiple routes
Before this commit, if an invoice encoded multiple `r` fields, we would
decode them as one single route. We fix this by allowing an invoice to
store multiple routes.
2018-04-20 04:01:34 -04:00
Olaoluwa Osuntokun
10847170ee
zpay32: adjust uint64 encoding to account for math.MaxUnit64
In this commit, we fix a logic error in our routine for converting a
uint64 to/from base32. Before this commit, we assumed that the max
number of groups was 12. However, the math.MaxUint64 (1<<64 - 1) can
actually consume more than 12 groups with an extra set of bits. Before
this commit, we would panic when attempting to parse an invoice
generated like so:
  * addinvoice --amt 1337000 --expiry 99999999999999999

To fix this issue, we modify our logic to expect at most 13 groups.
Additionally, we've added a new test that would panic before applying
this commit.

Fixes #972.
2018-03-29 16:24:20 -07:00
Olaoluwa Osuntokun
8d35ea381e
zpay32: remove test case with negative amt 2018-03-08 12:50:50 -05:00
Wilmer Paulino
cfb19b8d51
invoice: avoid negative msat amounts 2018-01-23 14:38:20 -05:00
Wilmer Paulino
8807fb804b
invoice: add unit tests for each parsed tagged field
This commit introduces unit tests for each parsed tagged field to cover
all possible input scenarios.
2018-01-19 12:00:51 -05:00
Johan T. Halseth
b645f02418
zpay32: move the BOLT-11 compatible invoice format to zpay32 namespace 2017-09-27 12:26:06 +02:00