| 209 | } |
| 210 | |
| 211 | void RequestedTx(int peer, int txhash, std::chrono::microseconds exptime) |
| 212 | { |
| 213 | // Apply to naive structure: if a CANDIDATE announcement exists for peer/txhash, |
| 214 | // convert it to REQUESTED, and change any existing REQUESTED announcement for the same txhash to COMPLETED. |
| 215 | if (m_announcements[txhash][peer].m_state == State::CANDIDATE) { |
| 216 | for (int peer2 = 0; peer2 < MAX_PEERS; ++peer2) { |
| 217 | if (m_announcements[txhash][peer2].m_state == State::REQUESTED) { |
| 218 | m_announcements[txhash][peer2].m_state = State::COMPLETED; |
| 219 | } |
| 220 | } |
| 221 | m_announcements[txhash][peer].m_state = State::REQUESTED; |
| 222 | m_announcements[txhash][peer].m_time = exptime; |
| 223 | } |
| 224 | |
| 225 | // Add event so that AdvanceToEvent can quickly jump to the point where its exptime passes. |
| 226 | if (exptime > m_now) m_events.push(exptime); |
| 227 | |
| 228 | // Call TxRequestTracker's implementation. |
| 229 | m_tracker.RequestedTx(peer, TXHASHES[txhash], exptime); |
| 230 | } |
| 231 | |
| 232 | void ReceivedResponse(int peer, int txhash) |
| 233 | { |
no outgoing calls
no test coverage detected