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

Method FindAddressEntry_

src/addrman.cpp:933–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

931}
932
933std::optional<AddressPosition> AddrManImpl::FindAddressEntry_(const CAddress& addr)
934{
935 AssertLockHeld(cs);
936
937 AddrInfo* addr_info = Find(addr);
938
939 if (!addr_info) return std::nullopt;
940
941 if(addr_info->fInTried) {
942 int bucket{addr_info->GetTriedBucket(nKey, m_asmap)};
943 return AddressPosition(/*tried=*/true,
944 /*multiplicity=*/1,
945 /*bucket=*/bucket,
946 /*position=*/addr_info->GetBucketPosition(nKey, false, bucket));
947 } else {
948 int bucket{addr_info->GetNewBucket(nKey, m_asmap)};
949 return AddressPosition(/*tried=*/false,
950 /*multiplicity=*/addr_info->nRefCount,
951 /*bucket=*/bucket,
952 /*position=*/addr_info->GetBucketPosition(nKey, true, bucket));
953 }
954}
955
956void AddrManImpl::Check() const
957{

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected