Refactored Chain a lot to make it possible to test.

Added a CPU hard test for Chain, checking all current DB.
Added an option to config file to set a count of checked top blocks on start.
This commit is contained in:
Revertron
2021-04-26 21:49:01 +02:00
parent 5677b860e4
commit fcb920e0de
10 changed files with 142 additions and 123 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ impl DnsFilter for BlockchainFilter {
let zone = parts[0].to_owned();
match data {
None => {
if self.context.lock().unwrap().chain.is_zone_in_blockchain(&zone) {
if self.context.lock().unwrap().chain.is_zone_in_blockchain(u64::MAX, &zone) {
trace!("Not found data for domain {}", &search);
// Create DnsPacket
let mut packet = DnsPacket::new();
@@ -192,7 +192,7 @@ impl BlockchainFilter {
}
fn get_zone_response(&self, zone: &str, mut packet: &mut DnsPacket) -> bool {
let have_zone = self.context.lock().unwrap().chain.is_zone_in_blockchain(zone);
let have_zone = self.context.lock().unwrap().chain.is_zone_in_blockchain(i64::MAX as u64, zone);
if have_zone {
BlockchainFilter::add_soa_record(zone.to_owned(), &mut packet);
}