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
44
45
46
47
48
49
50
51
52
53
54
55
crate::ix!();
impl BlockConnected for PeerManager {
fn block_connected(&mut self,
pblock: Arc<Block>,
pindex: Arc<BlockIndex>) {
self.orphanage.clone().erase_for_block(&*pblock);
self.last_tip_update.store(Some(get_datetime()), atomic::Ordering::Relaxed);
{
let mut guard = self.recent_confirmed_transactions_mutex.get_mut();
for ptx in (*pblock).vtx.iter() {
guard.recent_confirmed_transactions.insert_key(
ptx.get().get_hash().as_slice()
);
if ptx.get().get_hash() != ptx.get().get_witness_hash() {
guard.recent_confirmed_transactions.insert_key(
ptx.get().get_witness_hash().as_slice()
);
}
}
}
{
let mut guard = CS_MAIN.lock();
for ptx in (*pblock).vtx.iter() {
let guard = self.inner.lock();
let mut txreq = guard.txrequest.lock();
txreq.forget_tx_hash(ptx.get().get_hash());
txreq.forget_tx_hash(ptx.get().get_witness_hash());
}
}
}
}