-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fixes stuff inside bolt12 decode #324
Fixes stuff inside bolt12 decode #324
Conversation
Plus |
@Harshit933 can you post another time the And/or probably write a test to make sure that what we should have as a hex string it is not a vector of bytes? otherwise LGMT Thanks :) |
Updated the description also added a test in 593fe3e |
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.
Ok I did another review, thanks for doing it.
I think the git history need some kind of rework (squash the commit with the one that are no longer true) and then we are ready to go :)
Thanks for doing it
d25a806
to
5e19836
Compare
This commit adds another struct namely `Bolt12Invoice` to structure all the information regarding it. Also renames the `InvoiceInfo` to `Bolt11InvoiceInfo`, mainly for holding bolt11 info.
This commits renames the previous testing server command for decoding offers ("decode_invoice") to `decode` and also changes all its occurings in the testing code.
6a3a72c
to
6a02c69
Compare
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.
Concept ACK 6a02c69
Small comments on the code still, but we are good to go! thanks for working on it
This commit adds an integration test to check if the `offer_id` is a hex string or not.
6a02c69
to
035af1b
Compare
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
let network = offer | ||
.chains() | ||
.first() | ||
.map(|hash| Network::from_chain_hash(*hash)) | ||
.unwrap_or(Some(Network::Bitcoin)); | ||
.and_then(|hash| Network::from_chain_hash(*hash)) | ||
.or(Some(Network::Bitcoin)); |
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.
Good also for a folloup PR, but I would like to leave this Optional and not try to force the type here!
If there is any chain
, will remain None
// Checks if all the character inside the offer_id is hex. | ||
let res = decode.offer_id.chars().all(|c| c.is_ascii_hexdigit()); | ||
assert!(res); |
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.
we can remove this code, I do not understand it, so better remove it (also in a follup PR)
This removes the validation check in hex as discussed in issues vincenzopalazzo#351 and vincenzopalazzo#324.
Decoding bolt12 now:
If the bolt11/bolt12 is invalid:
UPDATE:
Running
lampo-cli --network regtest decode --invoice_str lno1qgsyxjtl6luzd9t3pr62xr7eemp6awnejusgf6gw45q75vcfqqqqqqqsespexwyy4tcadvgg89l9aljus6709kx235hhqrk6n8dey98uyuftzdqzrtkahuum7m56dxlnx8r6tffy54004l7kvs7pylmxx7xs4n54986qyqeeuhhunayntt50snmdkq4t7fzsgghpl69v9csgparek8kv7dlp5uqr8ymp5s4z9upmwr2s8xu020d45t5phqc8nljrq8gzsjmurzevawjz6j6rc95xwfvnhgfx6v4c3jha7jwynecrz3y092nn25ek4yl7xp9yu9ry9zqagt0ktn4wwvqg52v9ss9ls22sqyqqestzp2l6decpn87pq96udsvx
Gives the following output:
See commits for more info.
Fixes #270 #318