Renamed prefix on oracle network

This commit is contained in:
Dave
2025-06-12 15:50:42 -04:00
parent e2d50144ca
commit 97711e2ecf
3 changed files with 7 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
mod network_crdt;
mod node;
pub(crate) use network_crdt::OracleNetworkCRDT;
pub(crate) use network_crdt::NetworkCRDT;
pub(crate) use node::OracleNode as Node;

View File

@@ -3,12 +3,12 @@ use std::collections::HashMap;
use crate::{utils, AssetPair, OracleId, PriceAttestation};
#[derive(Clone)]
pub(crate) struct OracleNetworkCRDT {
pub(crate) struct NetworkCRDT {
pub(crate) attestations: HashMap<String, PriceAttestation>,
pub(crate) oracle_scores: HashMap<OracleId, f64>,
}
impl OracleNetworkCRDT {
impl NetworkCRDT {
pub(crate) fn new() -> Self {
Self {
attestations: HashMap::new(),

View File

@@ -1,12 +1,10 @@
use std::sync::{Arc, Mutex};
use crate::{oracle, utils, AssetPair, OracleId, PriceAttestation};
use rand::Rng;
use crate::{utils, AssetPair, OracleId, PriceAttestation};
use std::sync::{Arc, Mutex};
pub(crate) struct OracleNode {
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) base_price: f64,
}
@@ -15,7 +13,7 @@ impl OracleNode {
pub(crate) fn new(id: String, is_byzantine: bool) -> Self {
Self {
id: OracleId(id),
crdt: Arc::new(Mutex::new(super::OracleNetworkCRDT::new())),
crdt: Arc::new(Mutex::new(oracle::NetworkCRDT::new())),
is_byzantine,
base_price: 2500.0,
}