MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / FindAddressEntry_

Method FindAddressEntry_

src/addrman.cpp:984–1005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982}
983
984std::optional<AddressPosition> AddrManImpl::FindAddressEntry_(const CAddress& addr)
985{
986 AssertLockHeld(cs);
987
988 AddrInfo* addr_info = Find(addr);
989
990 if (!addr_info) return std::nullopt;
991
992 if(addr_info->fInTried) {
993 int bucket{addr_info->GetTriedBucket(nKey, m_netgroupman)};
994 return AddressPosition(/*tried_in=*/true,
995 /*multiplicity_in=*/1,
996 /*bucket_in=*/bucket,
997 /*position_in=*/addr_info->GetBucketPosition(nKey, false, bucket));
998 } else {
999 int bucket{addr_info->GetNewBucket(nKey, m_netgroupman)};
1000 return AddressPosition(/*tried_in=*/false,
1001 /*multiplicity_in=*/addr_info->nRefCount,
1002 /*bucket_in=*/bucket,
1003 /*position_in=*/addr_info->GetBucketPosition(nKey, true, bucket));
1004 }
1005}
1006
1007size_t AddrManImpl::Size_(std::optional<Network> net, std::optional<bool> in_new) const
1008{

Callers

nothing calls this directly

Calls 5

FindFunction · 0.85
AddressPositionClass · 0.85
GetTriedBucketMethod · 0.80
GetBucketPositionMethod · 0.80
GetNewBucketMethod · 0.45

Tested by

no test coverage detected