Skip to content

Commit

Permalink
fix: dpc nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Mar 11, 2024
1 parent 998b934 commit 504638f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions devimint/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ pub async fn latency_tests(dev_fed: DevFed, r#type: LatencyTest) -> Result<()> {
}

pub async fn cli_tests(dev_fed: DevFed) -> Result<()> {
let fedimint_cli_version = crate::util::FedimintCli::version_or_default().await;
let version_req = VersionReq::parse(">=0.3.0-alpha")?;
log_binary_versions().await?;
let data_dir = env::var("FM_DATA_DIR")?;

Expand Down Expand Up @@ -413,6 +411,9 @@ pub async fn cli_tests(dev_fed: DevFed) -> Result<()> {
let fed_id = fed.calculate_federation_id().await;
let invite = fed.invite_code()?;

let fedimint_cli_version = crate::util::FedimintCli::version_or_default().await;
let version_req = VersionReq::parse(">=0.3.0-alpha")?;

let invite_code = if version_req.matches(&fedimint_cli_version) {
cmd!(client, "dev", "decode", "invite-code", invite.clone())
} else {
Expand Down
12 changes: 6 additions & 6 deletions modules/fedimint-mint-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ impl OOBNotes {
}

pub fn notes_json(&self) -> Result<serde_json::Value, serde_json::Error> {
let mut map = serde_json::Map::new();
let mut notes_map = serde_json::Map::new();
for notes in self.0.iter() {
match notes {
OOBNotesData::Notes(notes) => {
let notes_json = serde_json::to_value(notes).expect("serialization can't fail");
map.insert("notes".to_string(), notes_json);
notes_map.insert("notes".to_string(), notes_json);
}
OOBNotesData::FederationIdPrefix(prefix) => {
map.insert(
notes_map.insert(
"federation_id_prefix".to_string(),
serde_json::to_value(prefix.to_string())?,
);
Expand All @@ -177,20 +177,20 @@ impl OOBNotes {
.first()
.cloned()
.expect("Decoding makes sure peer_apis isn't empty");
map.insert(
notes_map.insert(
"invite".to_string(),
serde_json::to_value(InviteCode::new(api, peer_id, *federation_id))?,
);
}
OOBNotesData::Default { variant, bytes } => {
map.insert(
notes_map.insert(
format!("default_{}", variant),
serde_json::to_value(bytes.to_hex())?,
);
}
}
}
Ok(serde_json::Value::Object(map))
Ok(serde_json::Value::Object(notes_map))
}

pub fn federation_invite(&self) -> Option<InviteCode> {
Expand Down

0 comments on commit 504638f

Please sign in to comment.