| 187 | } |
| 188 | |
| 189 | void ReceivedInv(int peer, int txhash, bool is_wtxid, bool preferred, std::chrono::microseconds reqtime) |
| 190 | { |
| 191 | // Apply to naive structure: if no announcement for txidnum/peer combination |
| 192 | // already, create a new CANDIDATE; otherwise do nothing. |
| 193 | Announcement& ann = m_announcements[txhash][peer]; |
| 194 | if (ann.m_state == State::NOTHING) { |
| 195 | ann.m_preferred = preferred; |
| 196 | ann.m_state = State::CANDIDATE; |
| 197 | ann.m_time = reqtime; |
| 198 | ann.m_is_wtxid = is_wtxid; |
| 199 | ann.m_sequence = m_current_sequence++; |
| 200 | ann.m_priority = m_tracker.ComputePriority(TXHASHES[txhash], peer, ann.m_preferred); |
| 201 | |
| 202 | // Add event so that AdvanceToEvent can quickly jump to the point where its reqtime passes. |
| 203 | if (reqtime > m_now) m_events.push(reqtime); |
| 204 | } |
| 205 | |
| 206 | // Call TxRequestTracker's implementation. |
| 207 | m_tracker.ReceivedInv(peer, is_wtxid ? GenTxid::Wtxid(TXHASHES[txhash]) : GenTxid::Txid(TXHASHES[txhash]), preferred, reqtime); |
| 208 | } |
| 209 | |
| 210 | void RequestedTx(int peer, int txhash, std::chrono::microseconds exptime) |
| 211 | { |
no test coverage detected