MCPcopy Create free account
hub / github.com/ElementsProject/elements / RecomputePeerInfo

Function RecomputePeerInfo

src/txrequest.cpp:265–275  ·  view source on GitHub ↗

(Re)compute the PeerInfo map from the index. Only used for sanity checking. */

Source from the content-addressed store, hash-verified

263
264/** (Re)compute the PeerInfo map from the index. Only used for sanity checking. */
265std::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. */
278std::map<uint256, TxHashInfo> ComputeTxHashInfo(const Index& index, const PriorityComputer& computer)

Callers 1

SanityCheckMethod · 0.85

Calls 1

GetStateMethod · 0.80

Tested by

no test coverage detected