mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 07:08:05 -05:00
fu: handle events with no info field
This commit is contained in:
@@ -254,8 +254,12 @@ impl Fu {
|
||||
match subscription.receive().await {
|
||||
JsonResult::Notification(n) => {
|
||||
let params = n.params.get::<HashMap<String, JsonValue>>().unwrap();
|
||||
let info =
|
||||
params.get("info").unwrap().get::<HashMap<String, JsonValue>>().unwrap();
|
||||
let info = params.get("info");
|
||||
if info.is_none() {
|
||||
continue
|
||||
}
|
||||
let info = info.unwrap().get::<HashMap<String, JsonValue>>().unwrap();
|
||||
|
||||
let hash = match info.get("hash") {
|
||||
Some(hash_value) => hash_value.get::<String>().unwrap(),
|
||||
None => continue,
|
||||
@@ -725,8 +729,11 @@ impl Fu {
|
||||
match subscription.receive().await {
|
||||
JsonResult::Notification(n) => {
|
||||
let params = n.params.get::<HashMap<String, JsonValue>>().unwrap();
|
||||
let info =
|
||||
params.get("info").unwrap().get::<HashMap<String, JsonValue>>().unwrap();
|
||||
let info = params.get("info");
|
||||
if info.is_none() {
|
||||
continue
|
||||
}
|
||||
let info = info.unwrap().get::<HashMap<String, JsonValue>>().unwrap();
|
||||
match params.get("event").unwrap().get::<String>().unwrap().as_str() {
|
||||
"download_started" |
|
||||
"metadata_download_completed" |
|
||||
|
||||
Reference in New Issue
Block a user