Skip to content

Commit

Permalink
bring back removed code
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdrz committed Sep 16, 2020
1 parent 370b095 commit 404e454
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions bee-protocol/src/worker/requester/transaction.rs
Expand Up @@ -67,6 +67,23 @@ impl TransactionRequesterWorker {

let guard = Protocol::get().peer_manager.handshaked_peers_keys.read().await;

for _ in 0..guard.len() {
let epid = &guard[self.counter % guard.len()];

self.counter += 1;

if let Some(peer) = Protocol::get().peer_manager.handshaked_peers.get(epid) {
if peer.has_data(index) {
let hash = hash.as_trits().encode::<T5B1Buf>();
Sender::<TransactionRequest>::send(
epid,
TransactionRequest::new(cast_slice(hash.as_i8_slice())),
);
return true;
}
}
}

for _ in 0..guard.len() {
let epid = &guard[self.counter % guard.len()];

Expand All @@ -92,10 +109,7 @@ impl TransactionRequesterWorker {
if let Some(peer) = Protocol::get().peer_manager.handshaked_peers.get(epid) {
if peer.maybe_has_data(index) {
let hash = hash.as_trits().encode::<T5B1Buf>();
Sender::<TransactionRequest>::send(
epid,
TransactionRequest::new(cast_slice(hash.as_i8_slice())),
);
Sender::<TransactionRequest>::send(epid, TransactionRequest::new(cast_slice(hash.as_i8_slice())));
return true;
}
}
Expand Down

0 comments on commit 404e454

Please sign in to comment.