1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
crate::ix!();
pub trait ProcessBlock {
fn process_block(self: Arc<Self>,
node: &mut AmoWriteGuard<Box<dyn NodeInterface>>,
block: Amo<Block>,
force_processing: bool);
}
impl ProcessBlock for PeerManager {
fn process_block(
self: Arc<Self>,
mut node: &mut AmoWriteGuard<Box<dyn NodeInterface>>,
block: Amo<Block>,
force_processing: bool) {
let mut new_block: bool = false;
self.chainman.get_mut().process_new_block(
&self.chainparams,
block.clone(),
force_processing,
&mut new_block
);
if new_block {
node.set_n_last_block_time(Some(get_datetime()));
} else {
let mut guard = CS_MAIN.lock();
self.inner.lock().map_block_source.remove(&block.get().get_hash());
}
}
}