Complete Issue #023: nac-acc-1410 ACC-1410分区协议完善 - 实现分区间转账、批量操作、事件通知、性能优化 (75%->100%)
This commit is contained in:
parent
e96b4202c7
commit
c3f2f90206
|
|
@ -235,6 +235,7 @@ dependencies = [
|
||||||
"hex",
|
"hex",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"sha2",
|
||||||
"sha3",
|
"sha3",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
|
@ -366,6 +367,17 @@ dependencies = [
|
||||||
"zmij",
|
"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]]
|
[[package]]
|
||||||
name = "sha3"
|
name = "sha3"
|
||||||
version = "0.10.8"
|
version = "0.10.8"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
sha2 = "0.10"
|
||||||
sha3 = "0.10"
|
sha3 = "0.10"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,12 @@ pub enum Acc1410Error {
|
||||||
FundsLocked { account: String, unlock_time: u64 },
|
FundsLocked { account: String, unlock_time: u64 },
|
||||||
InvalidReceiver(String),
|
InvalidReceiver(String),
|
||||||
InvalidSender(String),
|
InvalidSender(String),
|
||||||
|
InvalidTransfer(String),
|
||||||
TransfersHalted,
|
TransfersHalted,
|
||||||
InvalidGNACS(String),
|
InvalidGNACS(String),
|
||||||
PartitionAlreadyExists(String),
|
PartitionAlreadyExists(String),
|
||||||
|
NotFound(String),
|
||||||
|
InvalidAmount(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Acc1410Error {
|
impl fmt::Display for Acc1410Error {
|
||||||
|
|
@ -33,9 +36,12 @@ impl fmt::Display for Acc1410Error {
|
||||||
}
|
}
|
||||||
Self::InvalidReceiver(addr) => write!(f, "Invalid receiver: {}", addr),
|
Self::InvalidReceiver(addr) => write!(f, "Invalid receiver: {}", addr),
|
||||||
Self::InvalidSender(addr) => write!(f, "Invalid sender: {}", 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::TransfersHalted => write!(f, "Transfers are currently halted"),
|
||||||
Self::InvalidGNACS(msg) => write!(f, "Invalid GNACS: {}", msg),
|
Self::InvalidGNACS(msg) => write!(f, "Invalid GNACS: {}", msg),
|
||||||
Self::PartitionAlreadyExists(id) => write!(f, "Partition already exists: {}", id),
|
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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,6 @@ pub struct EventFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 事件管理器
|
/// 事件管理器
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct EventManager {
|
pub struct EventManager {
|
||||||
/// 事件日志
|
/// 事件日志
|
||||||
event_log: Vec<EventRecord>,
|
event_log: Vec<EventRecord>,
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ impl ConcurrentProcessor {
|
||||||
/// 并发处理批量任务
|
/// 并发处理批量任务
|
||||||
pub fn process_batch<T, F, R>(&self, items: Vec<T>, processor: F) -> Vec<R>
|
pub fn process_batch<T, F, R>(&self, items: Vec<T>, processor: F) -> Vec<R>
|
||||||
where
|
where
|
||||||
T: Send + 'static,
|
T: Send + Clone + 'static,
|
||||||
F: Fn(T) -> R + Send + Sync + 'static,
|
F: Fn(T) -> R + Send + Sync + 'static,
|
||||||
R: Send + 'static,
|
R: Send + 'static,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue