use blvm_node::network::chain_access::NodeChainAccess;
use blvm_node::node::mempool::MempoolManager;
use blvm_node::storage::Storage;
use std::sync::Arc;
use tempfile::TempDir;
#[test]
fn test_storage_returns_arcs() {
let temp_dir = TempDir::new().unwrap();
let storage = Storage::new(temp_dir.path()).unwrap();
let blocks_arc = storage.blocks();
let blocks_arc2 = storage.blocks();
assert!(Arc::ptr_eq(&blocks_arc, &blocks_arc2) || blocks_arc.block_count().is_ok());
let tx_arc = storage.transactions();
let tx_arc2 = storage.transactions();
assert!(Arc::ptr_eq(&tx_arc, &tx_arc2) || tx_arc.has_transaction(&[0u8; 32]).is_ok());
}
#[test]
fn test_node_chain_access_creation() {
let temp_dir = TempDir::new().unwrap();
let storage = Storage::new(temp_dir.path()).unwrap();
let mempool = Arc::new(MempoolManager::new());
let chain_access = NodeChainAccess::new(storage.blocks(), storage.transactions(), mempool);
let hash = [0u8; 32];
use blvm_protocol::network::ChainStateAccess;
let has_object = chain_access.has_object(&hash);
assert!(!has_object); }