(Re)compute the PeerInfo map from the index. Only used for sanity checking. */
| 263 | |
| 264 | /** (Re)compute the PeerInfo map from the index. Only used for sanity checking. */ |
| 265 | std::unordered_map<NodeId, PeerInfo> RecomputePeerInfo(const Index& index) |
| 266 | { |
| 267 | std::unordered_map<NodeId, PeerInfo> ret; |
| 268 | for (const Announcement& ann : index) { |
| 269 | PeerInfo& info = ret[ann.m_peer]; |
| 270 | ++info.m_total; |
| 271 | info.m_requested += (ann.GetState() == State::REQUESTED); |
| 272 | info.m_completed += (ann.GetState() == State::COMPLETED); |
| 273 | } |
| 274 | return ret; |
| 275 | } |
| 276 | |
| 277 | /** Compute the TxHashInfo map. Only used for sanity checking. */ |
| 278 | std::map<uint256, TxHashInfo> ComputeTxHashInfo(const Index& index, const PriorityComputer& computer) |