AddrMan::Add

Attempt to add one or more addresses to addrman's new table. If an address already exists in addrman, the existing entry may be updated (e.g. adding additional service flags). If the existing entry is in the new table, it may be added to more buckets, improving the probability of selection.

Synopsis

Declared in <addrman.h>

bool
Add(
    std::vector<CAddress> const& vAddr,
    CNetAddr const& source,
    std::chrono::seconds time_penalty = 0s);

Return Value

true if at least one address is successfully added, or added to an additional bucket. Unaffected by updates.

Parameters

NameDescription
vAddr [in]Address records to attempt to add.
source [in]The address of the node that sent us these addr records.
time_penalty [in]A "time penalty" to apply to the address record's nTime. If a peer sends us an address record with nTime=n, then we'll add it to our addrman with nTime=(n - time_penalty).