Skip to content

Conversation

@Dolu89
Copy link
Member

@Dolu89 Dolu89 commented Aug 17, 2022

  • LndRest
  • EclairRest
  • ClnGrpc

@Dolu89 Dolu89 linked an issue Aug 17, 2022 that may be closed by this pull request
@Dolu89 Dolu89 marked this pull request as ready for review August 19, 2022 14:36
Copy link
Member

@louneskmt louneskmt left a comment

Choose a reason for hiding this comment

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

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 👌

use std::collections::HashMap;

use crate::error::Error;
use crate::utils::{b64_to_hex, parse_number};
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above regarding the utils crate import.

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"),
Copy link
Member

Choose a reason for hiding this comment

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

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.


#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum InvoiceStateResponse {
Copy link
Member

Choose a reason for hiding this comment

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

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.

Add get invoice feature

2 participants