Open
Conversation
louneskmt
requested changes
Aug 19, 2022
Member
louneskmt
left a comment
There was a problem hiding this comment.
Changing configs in test files pollutes the diff (in my PRs too), let's replace them by "dummy cert", "dummy macaroon", etc strings from now on, until we have proper unit tests. I'm working on it 👌
core/src/backends/lnd/rest/types.rs
Outdated
| use std::collections::HashMap; | ||
|
|
||
| use crate::error::Error; | ||
| use crate::utils::{b64_to_hex, parse_number}; |
Member
There was a problem hiding this comment.
Same comment as above regarding the utils crate import.
core/src/backends/lnd/rest/types.rs
Outdated
Comment on lines
180
to
192
| amount: parse_number(&self.value).expect("amt_paid_sat should be a number"), | ||
| amount_msat: parse_number(&self.value_msat).expect("amt_paid_msat should be a number"), | ||
| pre_image: Some( | ||
| b64_to_hex(&self.r_preimage) | ||
| .expect("coudln't convert r_preimage from base64 to hex"), | ||
| ), | ||
| payment_hash: b64_to_hex(&self.r_hash) | ||
| .expect("coudln't convert r_hash from base64 to hex"), | ||
| settled: self.settled, | ||
| settle_date, | ||
| creation_date: parse_number(&self.creation_date) | ||
| .expect("creation_date should be a number"), | ||
| expiry: parse_number(&self.expiry).expect("expiry should be a number"), |
Member
There was a problem hiding this comment.
We should avoid the use of expect and unwrap as much as possible, as it panics the program. Consider adding a custom parsing error and raise it in the parse_number function like I did in for b64_to_hex.
Co-authored-by: Lounès Ksouri <dev@louneskmt.com>
louneskmt
reviewed
Aug 22, 2022
|
|
||
| #[derive(Debug, Deserialize, Serialize)] | ||
| #[serde(rename_all = "UPPERCASE")] | ||
| pub enum InvoiceStateResponse { |
Member
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.