Sync block verification (#74)
* Synchronize block verification * max_round_blocks_to_import set to 1 * Fixed test that rely on 12block batches Co-authored-by: adria0.eth <5526331+adria0@users.noreply.github.com>
This commit is contained in:
@@ -389,6 +389,8 @@ impl Importer {
|
||||
|
||||
let db = client.db.read();
|
||||
db.key_value().flush().expect("DB flush failed.");
|
||||
|
||||
self.block_queue.resignal_verification();
|
||||
imported
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ impl Default for ClientConfig {
|
||||
history_mem: 32 * mb,
|
||||
check_seal: true,
|
||||
transaction_verification_queue_size: 8192,
|
||||
max_round_blocks_to_import: 12,
|
||||
max_round_blocks_to_import: 1,
|
||||
snapshot: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ fn can_handle_long_fork() {
|
||||
push_blocks_to_client(&client, 49, 1201, 800);
|
||||
push_blocks_to_client(&client, 53, 1201, 600);
|
||||
|
||||
for _ in 0..400 {
|
||||
for _ in 0..2300 {
|
||||
client.import_verified_blocks();
|
||||
}
|
||||
assert_eq!(2000, client.chain_info().best_block_number);
|
||||
|
||||
@@ -665,11 +665,17 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
.verified
|
||||
.fetch_sub(drained_size, AtomicOrdering::SeqCst);
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
/// release taken signal and call async ClientIoMessage::BlockVerified call to client so that it can continue verification.
|
||||
/// difference between sync and async is whose thread pool is used.
|
||||
pub fn resignal_verification(&self) {
|
||||
let verified = self.verification.verified.lock();
|
||||
self.ready_signal.reset();
|
||||
if !verified.is_empty() {
|
||||
self.ready_signal.set_async();
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/// Returns true if there is nothing currently in the queue.
|
||||
|
||||
Reference in New Issue
Block a user