diff --git a/nac-acc-1410/Cargo.lock b/nac-acc-1410/Cargo.lock index 7d5d67d..5650d7d 100644 --- a/nac-acc-1410/Cargo.lock +++ b/nac-acc-1410/Cargo.lock @@ -235,6 +235,7 @@ dependencies = [ "hex", "serde", "serde_json", + "sha2", "sha3", "tokio", "tracing", @@ -366,6 +367,17 @@ dependencies = [ "zmij", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" diff --git a/nac-acc-1410/Cargo.toml b/nac-acc-1410/Cargo.toml index 7685da6..7c79eae 100644 --- a/nac-acc-1410/Cargo.toml +++ b/nac-acc-1410/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" +sha2 = "0.10" sha3 = "0.10" hex = "0.4" chrono = "0.4" diff --git a/nac-acc-1410/src/error.rs b/nac-acc-1410/src/error.rs index eabad01..46ea521 100644 --- a/nac-acc-1410/src/error.rs +++ b/nac-acc-1410/src/error.rs @@ -11,9 +11,12 @@ pub enum Acc1410Error { FundsLocked { account: String, unlock_time: u64 }, InvalidReceiver(String), InvalidSender(String), + InvalidTransfer(String), TransfersHalted, InvalidGNACS(String), PartitionAlreadyExists(String), + NotFound(String), + InvalidAmount(String), } impl fmt::Display for Acc1410Error { @@ -33,9 +36,12 @@ impl fmt::Display for Acc1410Error { } Self::InvalidReceiver(addr) => write!(f, "Invalid receiver: {}", addr), Self::InvalidSender(addr) => write!(f, "Invalid sender: {}", addr), + Self::InvalidTransfer(msg) => write!(f, "Invalid transfer: {}", msg), Self::TransfersHalted => write!(f, "Transfers are currently halted"), Self::InvalidGNACS(msg) => write!(f, "Invalid GNACS: {}", msg), Self::PartitionAlreadyExists(id) => write!(f, "Partition already exists: {}", id), + Self::NotFound(msg) => write!(f, "Not found: {}", msg), + Self::InvalidAmount(msg) => write!(f, "Invalid amount: {}", msg), } } } diff --git a/nac-acc-1410/src/events.rs b/nac-acc-1410/src/events.rs index fbe0af3..c3b5edc 100644 --- a/nac-acc-1410/src/events.rs +++ b/nac-acc-1410/src/events.rs @@ -117,7 +117,6 @@ pub struct EventFilter { } /// 事件管理器 -#[derive(Debug)] pub struct EventManager { /// 事件日志 event_log: Vec, diff --git a/nac-acc-1410/src/optimization.rs b/nac-acc-1410/src/optimization.rs index 2cb2539..c25f36c 100644 --- a/nac-acc-1410/src/optimization.rs +++ b/nac-acc-1410/src/optimization.rs @@ -329,7 +329,7 @@ impl ConcurrentProcessor { /// 并发处理批量任务 pub fn process_batch(&self, items: Vec, processor: F) -> Vec where - T: Send + 'static, + T: Send + Clone + 'static, F: Fn(T) -> R + Send + Sync + 'static, R: Send + 'static, {