-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bolt11 test vector with amount in p
units
#699
Conversation
1fb0897
to
a7811b5
Compare
The error reported is some sort of alleged spelling error. But both words are correctly spelled.
|
You need to update the spellchecker dictionary ( |
Commit has been updated with these additional changes. |
Thanks, I'll test this vector as soon as I have a bit of time ;) |
How's it looking with your time, @t-bast? :) |
I'm sorry, I'm really swamped right now with Trampoline work... |
Sorry for the wait, thanks for your patience! |
OK, I've pushed a fixup which completes the decode description (this is our only example with an embedded route!), and also reencoded it using the example privkey. |
Thanks @rustyrussell, I verified the test vector with eclair and it works fine. |
Good point, see #736 |
See-also: lightning/bolts#699 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 1fbccd3
See-also: lightning/bolts#699 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* Ignore fields with invalid length As per the spec: > A reader: > * MUST skip over unknown fields, OR an f field with unknown version, OR p, h, s or n fields that do NOT have data_lengths of 52, 52, 52 or 53, respectively. * Add more Bolt 11 tests See lightning/bolts#699 and lightning/bolts#736 Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
This addresses lightning#692.
…iption. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixed merge conflict by rebasing and force pushing. This test vector is now presented as the last in the list of test vectors. |
@cfromknecht or @Roasbeef, do we have an ACK to merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I added this vector to lnd and we're also passing
* `p`: payment hash. | ||
* `p5`: `data_length` (`p` = 1, `5` = 20; 1 * 32 + 20 == 52) | ||
* `gc3xfm08u9qy06djf8dfflhugl6p7lgza6dsjxq454gxhj9t7a0s`: payment hash 462264ede7e14047e9b249da94fefc47f41f7d02ee9b091815a5506bc8abf75f | ||
* `d`: short description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be too late at this point, just some thoughts:
the rest of these fields seem tangential to testing pico amount? imo more minimal, targeted test cases are preferable. i see also that it was updated to test route hints as well, perhaps that should have been its own test case?
there are also a lot of constants that are defined and only used for this test, e.g. payment hash, expiry, description, etc. that could be shared with other tests since they don't seem to be exercising explicit edge cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, this test case may be covering too much. But that doesn't mean an implementation has to do all the checks if they're redundant with other tests, right? I don't mind updating this PR, but I'd rather not spend too much time on in since it's quite a trivial addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it depends on your testing framework, lnd asserts encoding/decoding and the in-memory representation. I wouldn't explain what I just went through as trivial, but it is done now :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allright then now that the painful code is written, let's merge this PR and let this test case live a long and happy life :D
This addresses #692. But as part of #692 some have also requested that the RFC is changed to specify that any amount with the pico-multiplier MUST be divisible by 10. This request is addressed in PR #700 (now merged).
+
+Breakdown:
+
+*
lnbc
: prefix, Lightning on bitcoin mainnet+*
9678785340p
: amount (9678785340 pico-bitcoin = 967878534 milli satoshi)+*
1
: Bech32 separator+*
pwmna7l
: timestamp (1572468703)+*
p
: payment hash...+*
d
: short description8d
:data_length
(8
= 7,d
= 13; 7 * 32 + 13 == 237)gfkx7cmtwd68yetpd5s9xar0wfjn5gpc8qhrsdfq24f5ggrxdaezqsnvda3kkum5wfjkzmfqf3jkgem9wgsyuctwdus9xgrcyqcjcgpzgfskx6eqf9hzqnteypzxz7fzypfhg6trddjhygrcyqezcgpzfysywmm5ypxxjemgw3hxjmn8yptk7untd9hxwg3q2d6xjcmtv4ezq7pqxgsxzmnyyqcjqmt0wfjjq6t5v4khx
: 'Blockstream Store: 88.85 USD for Blockstream Ledger Nano S x 1, "Back In My Day" Sticker x 2, "I Got Lightning Working" Sticker x 2 and 1 more items'+*
x
: expiry timeqy
:data_length
(q
= 0,y
= 2; 0 * 32 + 4 == 4)jw5q
: 604800 seconds (j
= 18,w
= 14,5
= 20,q
= 0; 18 * 32^3 + 14 * 32^2 + 20 * 32 + 0 == 604800)+*
r
: tagged field: route informationzj
:data_length
(z
= 2,j
= 18; 2 * 32 + 18 == 82)+*
s4x9qlmd57lq7wwr23n3a6pkayy3jpfucyptlncs2maswe3dnnjy3ce2cgrvykmxlfpvn6ptqfqz4df5uaulvd4hjkckuqxrqqkz8jgp
: signature+*
hputwh
: Bech32 checksum