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
crate::ix!();

pub trait IsBlockRequested {

    /**
      | Have we requested this block from a peer
      |
      */
    fn is_block_requested(&self, hash: &u256) -> bool;
}

impl IsBlockRequested for PeerManagerInner {

    #[EXCLUSIVE_LOCKS_REQUIRED(CS_MAIN)]
    fn is_block_requested(&self, hash: &u256) -> bool {
        
        let guard = self.map_blocks_in_flight.lock();

        guard.get(hash).is_some()
    }
}

impl IsBlockRequested for PeerManager {

    #[EXCLUSIVE_LOCKS_REQUIRED(CS_MAIN)]
    fn is_block_requested(&self, hash: &u256) -> bool {
        self.inner.lock().is_block_requested(hash)
    }
}