From 4cd958778314bc549ed7aaf1a95d7060131c398b Mon Sep 17 00:00:00 2001 From: xdustinface Date: Fri, 20 Mar 2026 13:27:02 +0700 Subject: [PATCH] chore: remove orphaned `key-wallet-manager` directory The merge into `key-wallet` (#503) left few things behind. --- key-wallet-manager/Cargo.toml | 37 ----- key-wallet-manager/src/test_utils/wallet.rs | 144 -------------------- 2 files changed, 181 deletions(-) delete mode 100644 key-wallet-manager/Cargo.toml delete mode 100644 key-wallet-manager/src/test_utils/wallet.rs diff --git a/key-wallet-manager/Cargo.toml b/key-wallet-manager/Cargo.toml deleted file mode 100644 index d588e21a0..000000000 --- a/key-wallet-manager/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "key-wallet-manager" -version = { workspace = true } -authors = ["The Dash Core Developers"] -edition = "2021" -description = "High-level wallet management for Dash using key-wallet primitives" -keywords = ["dash", "wallet", "transaction", "utxo", "hdwallet"] -readme = "README.md" -license = "CC0-1.0" - -[features] -default = ["std", "bincode"] -std = ["key-wallet/std", "secp256k1/std"] -serde = ["dep:serde", "key-wallet/serde", "dashcore/serde"] -getrandom = ["key-wallet/getrandom"] -bincode = ["dep:bincode", "key-wallet/bincode"] -test-utils = [] - -[dependencies] -key-wallet = { path = "../key-wallet", default-features = false } -dashcore = { path = "../dash" } -dashcore_hashes = { path = "../hashes" } -secp256k1 = { version = "0.30.0", default-features = false, features = ["recovery"] } -serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } -async-trait = "0.1" -bincode = { version = "2.0.1", optional = true } -zeroize = { version = "1.8", features = ["derive"] } -rayon = "1.11" -tokio = { version = "1.32", features = ["full"] } - -[dev-dependencies] -dashcore = { path = "../dash", features = ["test-utils"] } -hex = "0.4" -serde_json = "1.0" - -[lints.rust] -unexpected_cfgs = { level = "allow", check-cfg = ['cfg(bench)', 'cfg(fuzzing)'] } diff --git a/key-wallet-manager/src/test_utils/wallet.rs b/key-wallet-manager/src/test_utils/wallet.rs deleted file mode 100644 index b7341fb29..000000000 --- a/key-wallet-manager/src/test_utils/wallet.rs +++ /dev/null @@ -1,144 +0,0 @@ -use crate::{wallet_interface::WalletInterface, BlockProcessingResult, WalletEvent}; -use dashcore::prelude::CoreBlockHeight; -use dashcore::{Address, Block, Transaction, Txid}; -use std::{collections::BTreeMap, sync::Arc}; -use tokio::sync::{broadcast, Mutex}; - -// Type alias for transaction effects map -type TransactionEffectsMap = Arc)>>>; - -pub struct MockWallet { - processed_blocks: Arc>>, - processed_transactions: Arc>>, - // Map txid -> (net_amount, addresses) - effects: TransactionEffectsMap, - synced_height: CoreBlockHeight, - event_sender: broadcast::Sender, -} - -impl Default for MockWallet { - fn default() -> Self { - Self::new() - } -} - -impl MockWallet { - pub fn new() -> Self { - let (event_sender, _) = broadcast::channel(16); - Self { - processed_blocks: Arc::new(Mutex::new(Vec::new())), - processed_transactions: Arc::new(Mutex::new(Vec::new())), - effects: Arc::new(Mutex::new(BTreeMap::new())), - synced_height: 0, - event_sender, - } - } - - pub async fn set_effect(&self, txid: dashcore::Txid, net: i64, addresses: Vec) { - let mut map = self.effects.lock().await; - map.insert(txid, (net, addresses)); - } - - pub fn processed_blocks(&self) -> Arc>> { - self.processed_blocks.clone() - } - - pub fn processed_transactions(&self) -> Arc>> { - self.processed_transactions.clone() - } -} - -#[async_trait::async_trait] -impl WalletInterface for MockWallet { - async fn process_block(&mut self, block: &Block, height: u32) -> BlockProcessingResult { - let mut processed = self.processed_blocks.lock().await; - processed.push((block.block_hash(), height)); - - BlockProcessingResult { - new_txids: block.txdata.iter().map(|tx| tx.txid()).collect(), - existing_txids: Vec::new(), - new_addresses: Vec::new(), - } - } - - async fn process_mempool_transaction(&mut self, tx: &Transaction) { - let mut processed = self.processed_transactions.lock().await; - processed.push(tx.txid()); - } - - async fn describe(&self) -> String { - "MockWallet (test implementation)".to_string() - } - - async fn transaction_effect(&self, tx: &Transaction) -> Option<(i64, Vec)> { - let map = self.effects.lock().await; - map.get(&tx.txid()).cloned() - } - - fn monitored_addresses(&self) -> Vec
{ - Vec::new() - } - - fn synced_height(&self) -> CoreBlockHeight { - self.synced_height - } - - fn update_synced_height(&mut self, height: CoreBlockHeight) { - self.synced_height = height; - } - - fn subscribe_events(&self) -> broadcast::Receiver { - self.event_sender.subscribe() - } -} - -/// Mock wallet that returns false for filter checks -pub struct NonMatchingMockWallet { - synced_height: CoreBlockHeight, - event_sender: broadcast::Sender, -} - -impl Default for NonMatchingMockWallet { - fn default() -> Self { - Self::new() - } -} - -impl NonMatchingMockWallet { - pub fn new() -> Self { - let (event_sender, _) = broadcast::channel(16); - Self { - synced_height: 0, - event_sender, - } - } -} - -#[async_trait::async_trait] -impl WalletInterface for NonMatchingMockWallet { - async fn process_block(&mut self, _block: &Block, _height: u32) -> BlockProcessingResult { - BlockProcessingResult::default() - } - - async fn process_mempool_transaction(&mut self, _tx: &Transaction) {} - - fn monitored_addresses(&self) -> Vec
{ - Vec::new() - } - - fn synced_height(&self) -> CoreBlockHeight { - self.synced_height - } - - fn update_synced_height(&mut self, height: CoreBlockHeight) { - self.synced_height = height; - } - - fn subscribe_events(&self) -> broadcast::Receiver { - self.event_sender.subscribe() - } - - async fn describe(&self) -> String { - "NonMatchingWallet (test implementation)".to_string() - } -}