Skip to content

Commit

Permalink
Avoid asmap copies in initialization
Browse files Browse the repository at this point in the history
Github-Pull: bitcoin#18023
Rebased-From: d58bcdc
  • Loading branch information
sipa authored and luke-jr committed Feb 15, 2020
1 parent c16c55f commit 30849d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1830,8 +1830,8 @@ bool AppInitMain(InitInterfaces& interfaces)
InitError(strprintf(_("Could not find or parse specified asmap: '%s'").translated, asmap_path));
return false;
}
g_connman->SetAsmap(asmap);
const uint256 asmap_version = SerializeHash(asmap);
g_connman->SetAsmap(std::move(asmap));
LogPrintf("Using asmap version %s for IP bucketing.\n", asmap_version.ToString());
} else {
LogPrintf("Using /16 prefix for IP bucketing.\n");
Expand Down
2 changes: 1 addition & 1 deletion src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class CConnman
*/
int64_t PoissonNextSendInbound(int64_t now, int average_interval_seconds);

void SetAsmap(std::vector<bool> asmap) { addrman.m_asmap = asmap; }
void SetAsmap(std::vector<bool> asmap) { addrman.m_asmap = std::move(asmap); }

private:
struct ListenSocket {
Expand Down

0 comments on commit 30849d5

Please sign in to comment.