Renamed prefix on oracle network
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
mod network_crdt;
|
mod network_crdt;
|
||||||
mod node;
|
mod node;
|
||||||
|
|
||||||
pub(crate) use network_crdt::OracleNetworkCRDT;
|
pub(crate) use network_crdt::NetworkCRDT;
|
||||||
pub(crate) use node::OracleNode as Node;
|
pub(crate) use node::OracleNode as Node;
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ use std::collections::HashMap;
|
|||||||
use crate::{utils, AssetPair, OracleId, PriceAttestation};
|
use crate::{utils, AssetPair, OracleId, PriceAttestation};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(crate) struct OracleNetworkCRDT {
|
pub(crate) struct NetworkCRDT {
|
||||||
pub(crate) attestations: HashMap<String, PriceAttestation>,
|
pub(crate) attestations: HashMap<String, PriceAttestation>,
|
||||||
pub(crate) oracle_scores: HashMap<OracleId, f64>,
|
pub(crate) oracle_scores: HashMap<OracleId, f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OracleNetworkCRDT {
|
impl NetworkCRDT {
|
||||||
pub(crate) fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
attestations: HashMap::new(),
|
attestations: HashMap::new(),
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
use std::sync::{Arc, Mutex};
|
use crate::{oracle, utils, AssetPair, OracleId, PriceAttestation};
|
||||||
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
use crate::{utils, AssetPair, OracleId, PriceAttestation};
|
|
||||||
|
|
||||||
pub(crate) struct OracleNode {
|
pub(crate) struct OracleNode {
|
||||||
pub(crate) id: OracleId,
|
pub(crate) id: OracleId,
|
||||||
pub(crate) crdt: Arc<Mutex<super::OracleNetworkCRDT>>,
|
pub(crate) crdt: Arc<Mutex<oracle::NetworkCRDT>>,
|
||||||
pub(crate) is_byzantine: bool,
|
pub(crate) is_byzantine: bool,
|
||||||
pub(crate) base_price: f64,
|
pub(crate) base_price: f64,
|
||||||
}
|
}
|
||||||
@@ -15,7 +13,7 @@ impl OracleNode {
|
|||||||
pub(crate) fn new(id: String, is_byzantine: bool) -> Self {
|
pub(crate) fn new(id: String, is_byzantine: bool) -> Self {
|
||||||
Self {
|
Self {
|
||||||
id: OracleId(id),
|
id: OracleId(id),
|
||||||
crdt: Arc::new(Mutex::new(super::OracleNetworkCRDT::new())),
|
crdt: Arc::new(Mutex::new(oracle::NetworkCRDT::new())),
|
||||||
is_byzantine,
|
is_byzantine,
|
||||||
base_price: 2500.0,
|
base_price: 2500.0,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user