Formatting and clippy changes
This commit is contained in:
parent
711a34cc2d
commit
c8b6bb9fdd
|
@ -66,7 +66,7 @@ impl DB {
|
||||||
if lox_db.was_recovered() && !lox_db.is_empty() {
|
if lox_db.was_recovered() && !lox_db.is_empty() {
|
||||||
context = match read_lox_context_from_db(lox_db.clone(), roll_back_date) {
|
context = match read_lox_context_from_db(lox_db.clone(), roll_back_date) {
|
||||||
Ok(ctx) => ctx,
|
Ok(ctx) => ctx,
|
||||||
Err(e) => panic!("Unable to read lox database {:?}", e)
|
Err(e) => panic!("Unable to read lox database {:?}", e),
|
||||||
};
|
};
|
||||||
context.metrics = metrics;
|
context.metrics = metrics;
|
||||||
//Otherwise, create a new Lox context
|
//Otherwise, create a new Lox context
|
||||||
|
@ -133,9 +133,7 @@ fn read_lox_context_from_db(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Use the last entry to populate the Lox context if no rollback date is set (which should be most common)
|
// Use the last entry to populate the Lox context if no rollback date is set (which should be most common)
|
||||||
None => {
|
None => context = use_last_context(lox_db)?,
|
||||||
context = use_last_context(lox_db)?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(context)
|
Ok(context)
|
||||||
}
|
}
|
||||||
|
@ -154,8 +152,8 @@ fn use_last_context(lox_db: sled::Db) -> Result<lox_context::LoxServerContext, L
|
||||||
let ivec_date: String = String::from_utf8(ivec_context.0.to_vec()).unwrap();
|
let ivec_date: String = String::from_utf8(ivec_context.0.to_vec()).unwrap();
|
||||||
println!("Using last context with date: {:?}", ivec_date);
|
println!("Using last context with date: {:?}", ivec_date);
|
||||||
Ok(serde_json::from_slice(&ivec_context.1).unwrap())
|
Ok(serde_json::from_slice(&ivec_context.1).unwrap())
|
||||||
},
|
}
|
||||||
None => Err(LoxDBError::DatabaseEmpty)
|
None => Err(LoxDBError::DatabaseEmpty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ use lox_library::{
|
||||||
use rdsys_backend::proto::{Resource, ResourceState};
|
use rdsys_backend::proto::{Resource, ResourceState};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use lox_zkp::ProofError;
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
};
|
};
|
||||||
use lox_zkp::ProofError;
|
|
||||||
|
|
||||||
use crate::metrics::Metrics;
|
use crate::metrics::Metrics;
|
||||||
use crate::resource_parser::{parse_into_bridgelines, sort_for_parsing};
|
use crate::resource_parser::{parse_into_bridgelines, sort_for_parsing};
|
||||||
|
|
|
@ -409,9 +409,11 @@ mod tests {
|
||||||
&pubkeys_obj.lox_pub,
|
&pubkeys_obj.lox_pub,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
let mut bridge = Vec::new();
|
||||||
|
bridge.push(lox_cred.1);
|
||||||
let lox_cred: lox_utils::LoxCredential = lox_utils::LoxCredential {
|
let lox_cred: lox_utils::LoxCredential = lox_utils::LoxCredential {
|
||||||
lox_credential: lox_cred.0,
|
lox_credential: lox_cred.0,
|
||||||
bridgeline: Some(lox_cred.1),
|
bridgelines: Some(bridge),
|
||||||
invitation: None,
|
invitation: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
use std::process::exit;
|
|
||||||
|
|
||||||
use chrono::{Duration, Utc};
|
use chrono::{Duration, Utc};
|
||||||
use lox_library::bridge_table::{BridgeLine, BRIDGE_BYTES, MAX_BRIDGES_PER_BUCKET};
|
use lox_library::bridge_table::{BridgeLine, BRIDGE_BYTES, MAX_BRIDGES_PER_BUCKET};
|
||||||
use rdsys_backend::proto::Resource;
|
use rdsys_backend::proto::Resource;
|
||||||
|
|
|
@ -266,11 +266,11 @@ impl BridgeDb {
|
||||||
let bucket = u32::from_le_bytes(invitation[32..(32 + 4)].try_into().unwrap());
|
let bucket = u32::from_le_bytes(invitation[32..(32 + 4)].try_into().unwrap());
|
||||||
let s = Scalar::from_canonical_bytes(invitation[0..32].try_into().unwrap());
|
let s = Scalar::from_canonical_bytes(invitation[0..32].try_into().unwrap());
|
||||||
if s.is_some().into() {
|
if s.is_some().into() {
|
||||||
return Ok((s.unwrap(), bucket));
|
Ok((s.unwrap(), bucket))
|
||||||
} else {
|
} else {
|
||||||
// It should never happen that there's a valid signature on
|
// It should never happen that there's a valid signature on
|
||||||
// an invalid serialization of a Scalar, but check anyway.
|
// an invalid serialization of a Scalar, but check anyway.
|
||||||
return Err(SignatureError::new());
|
Err(SignatureError::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue