mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-07 05:31:03 +02:00
addrman: Introduce helper to generalize looking up an addrman entry
Unused until later commit. Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
This commit is contained in:
parent
9bf078f66c
commit
052fbcd5a7
@ -792,6 +792,21 @@ std::pair<CAddress, NodeSeconds> AddrManImpl::Select_(bool newOnly) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AddrManImpl::GetEntry(bool use_tried, size_t bucket, size_t position) const
|
||||||
|
{
|
||||||
|
AssertLockHeld(cs);
|
||||||
|
|
||||||
|
assert(position < ADDRMAN_BUCKET_SIZE);
|
||||||
|
|
||||||
|
if (use_tried) {
|
||||||
|
assert(bucket < ADDRMAN_TRIED_BUCKET_COUNT);
|
||||||
|
return vvTried[bucket][position];
|
||||||
|
} else {
|
||||||
|
assert(bucket < ADDRMAN_NEW_BUCKET_COUNT);
|
||||||
|
return vvNew[bucket][position];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<CAddress> AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct, std::optional<Network> network) const
|
std::vector<CAddress> AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct, std::optional<Network> network) const
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs);
|
AssertLockHeld(cs);
|
||||||
|
@ -253,6 +253,12 @@ private:
|
|||||||
|
|
||||||
std::pair<CAddress, NodeSeconds> Select_(bool newOnly) const EXCLUSIVE_LOCKS_REQUIRED(cs);
|
std::pair<CAddress, NodeSeconds> Select_(bool newOnly) const EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||||
|
|
||||||
|
/** Helper to generalize looking up an addrman entry from either table.
|
||||||
|
*
|
||||||
|
* @return int The nid of the entry or -1 if the addrman position is empty.
|
||||||
|
* */
|
||||||
|
int GetEntry(bool use_tried, size_t bucket, size_t position) const EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||||
|
|
||||||
std::vector<CAddress> GetAddr_(size_t max_addresses, size_t max_pct, std::optional<Network> network) const EXCLUSIVE_LOCKS_REQUIRED(cs);
|
std::vector<CAddress> GetAddr_(size_t max_addresses, size_t max_pct, std::optional<Network> network) const EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||||
|
|
||||||
void Connected_(const CService& addr, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
void Connected_(const CService& addr, NodeSeconds time) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user