Compute the TxHashInfo map. Only used for sanity checking. */
| 276 | |
| 277 | /** Compute the TxHashInfo map. Only used for sanity checking. */ |
| 278 | std::map<uint256, TxHashInfo> ComputeTxHashInfo(const Index& index, const PriorityComputer& computer) |
| 279 | { |
| 280 | std::map<uint256, TxHashInfo> ret; |
| 281 | for (const Announcement& ann : index) { |
| 282 | TxHashInfo& info = ret[ann.m_txhash]; |
| 283 | // Classify how many announcements of each state we have for this txhash. |
| 284 | info.m_candidate_delayed += (ann.GetState() == State::CANDIDATE_DELAYED); |
| 285 | info.m_candidate_ready += (ann.GetState() == State::CANDIDATE_READY); |
| 286 | info.m_candidate_best += (ann.GetState() == State::CANDIDATE_BEST); |
| 287 | info.m_requested += (ann.GetState() == State::REQUESTED); |
| 288 | // And track the priority of the best CANDIDATE_READY/CANDIDATE_BEST announcements. |
| 289 | if (ann.GetState() == State::CANDIDATE_BEST) { |
| 290 | info.m_priority_candidate_best = computer(ann); |
| 291 | } |
| 292 | if (ann.GetState() == State::CANDIDATE_READY) { |
| 293 | info.m_priority_best_candidate_ready = std::max(info.m_priority_best_candidate_ready, computer(ann)); |
| 294 | } |
| 295 | // Also keep track of which peers this txhash has an announcement for (so we can detect duplicates). |
| 296 | info.m_peers.push_back(ann.m_peer); |
| 297 | } |
| 298 | return ret; |
| 299 | } |
| 300 | |
| 301 | GenTxid ToGenTxid(const Announcement& ann) |
| 302 | { |
no test coverage detected