Skip to content

Commit

Permalink
clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Stacks committed Sep 9, 2024
1 parent 25eb1e2 commit fa0e110
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 311 deletions.
1 change: 0 additions & 1 deletion consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ arc-swap.workspace = true
async-channel.workspace = true
bincode.workspace = true
crossbeam-channel.workspace = true
criterion.workspace = true
faster-hex.workspace = true
futures-util.workspace = true
indexmap.workspace = true
Expand Down
13 changes: 1 addition & 12 deletions consensus/src/pipeline/body_processor/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
deps_manager::{BlockProcessingMessage, BlockTaskDependencyManager, TaskId, VirtualStateProcessingMessage},
ProcessingCounters,
},
processes::{coinbase::CoinbaseManager, transaction_validator::TransactionValidator, window::WindowManager},
processes::{coinbase::CoinbaseManager, transaction_validator::TransactionValidator},
};
use crossbeam_channel::{Receiver, Sender};
use kaspa_consensus_core::{
Expand Down Expand Up @@ -82,8 +82,6 @@ pub struct BlockBodyProcessor {

/// Storage mass hardfork DAA score
pub(crate) storage_mass_activation_daa_score: u64,

time: Arc<RwLock<std::time::Instant>>,
}

impl BlockBodyProcessor {
Expand Down Expand Up @@ -134,7 +132,6 @@ impl BlockBodyProcessor {
notification_root,
counters,
storage_mass_activation_daa_score,
time: Arc::new(RwLock::new(std::time::Instant::now())),
}
}

Expand Down Expand Up @@ -236,14 +233,6 @@ impl BlockBodyProcessor {
}

fn commit_body(self: &Arc<BlockBodyProcessor>, hash: Hash, parents: &[Hash], transactions: Arc<Vec<Transaction>>) {
let mut time_guard = self.time.write();

if time_guard.elapsed().as_secs() > 10 {
self.window_manager.maybe_log();
*time_guard = std::time::Instant::now();
}
drop(time_guard);

let mut batch = WriteBatch::default();

// This is an append only store so it requires no lock.
Expand Down
22 changes: 2 additions & 20 deletions consensus/src/pipeline/header_processor/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ use crate::{
},
params::Params,
pipeline::deps_manager::{BlockProcessingMessage, BlockTask, BlockTaskDependencyManager, TaskId},
processes::{
ghostdag::ordering::SortableBlock, reachability::inquirer as reachability, relations::RelationsStoreExtensions,
window::WindowManager,
},
processes::{ghostdag::ordering::SortableBlock, reachability::inquirer as reachability, relations::RelationsStoreExtensions},
};
use crossbeam_channel::{Receiver, Sender};
use itertools::Itertools;
Expand All @@ -46,10 +43,7 @@ use kaspa_utils::vec::VecExtensions;
use parking_lot::RwLock;
use rayon::ThreadPool;
use rocksdb::WriteBatch;
use std::{
sync::{atomic::Ordering, Arc},
time::Instant,
};
use std::sync::{atomic::Ordering, Arc};

use super::super::ProcessingCounters;

Expand Down Expand Up @@ -160,8 +154,6 @@ pub struct HeaderProcessor {

// Counters
counters: Arc<ProcessingCounters>,

time: Arc<RwLock<Instant>>,
}

impl HeaderProcessor {
Expand Down Expand Up @@ -214,8 +206,6 @@ impl HeaderProcessor {
mergeset_size_limit: params.mergeset_size_limit,
skip_proof_of_work: params.skip_proof_of_work,
max_block_level: params.max_block_level,

time: Arc::new(RwLock::new(Instant::now())),
}
}

Expand Down Expand Up @@ -372,14 +362,6 @@ impl HeaderProcessor {
}

fn commit_header(&self, ctx: HeaderProcessingContext, header: &Header) {
let mut time_guard = self.time.write();

if time_guard.elapsed().as_secs() > 10 {
self.window_manager.maybe_log();
*time_guard = Instant::now();
}
drop(time_guard);

let ghostdag_data = ctx.ghostdag_data.as_ref().unwrap();
let pp = ctx.pruning_point();

Expand Down
Loading

0 comments on commit fa0e110

Please sign in to comment.