Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci/4 #4

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL
rpc/txoutproof.cpp
script/sigcache.cpp
signet.cpp
sockman.cpp
torcontrol.cpp
txdb.cpp
txmempool.cpp
Expand Down
821 changes: 285 additions & 536 deletions src/net.cpp

Large diffs are not rendered by default.

201 changes: 66 additions & 135 deletions src/net.h

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5523,10 +5523,15 @@ void PeerManagerImpl::EvictExtraOutboundPeers(std::chrono::seconds now)

m_connman.ForEachNode([&](CNode* pnode) {
if (!pnode->IsBlockOnlyConn() || pnode->fDisconnect) return;
if (pnode->GetId() > youngest_peer.first) {
next_youngest_peer = youngest_peer;
youngest_peer.first = pnode->GetId();
youngest_peer.second = pnode->m_last_block_time;
if (pnode->GetId() > next_youngest_peer.first) {
if (pnode->GetId() > youngest_peer.first) {
next_youngest_peer = youngest_peer;
youngest_peer.first = pnode->GetId();
youngest_peer.second = pnode->m_last_block_time;
} else {
next_youngest_peer.first = pnode->GetId();
next_youngest_peer.second = pnode->m_last_block_time;
}
}
});
NodeId to_disconnect = youngest_peer.first;
Expand Down
9 changes: 9 additions & 0 deletions src/rpc/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ static RPCHelpMan getpeerinfo()
std::vector<CNodeStats> vstats;
connman.GetNodeStats(vstats);

// An undocumented side effect of how CConnman previously stored nodes was
// that they were returned ordered by id. At least some functional tests
// rely on that, so keep it that way. An alternative is to remove this sort
// and fix the tests and take the risk of breaking other users of the
// "getpeerinfo" RPC.
std::sort(vstats.begin(), vstats.end(), [](const CNodeStats& a, const CNodeStats& b) {
return a.nodeid < b.nodeid;
});

UniValue ret(UniValue::VARR);

for (const CNodeStats& stats : vstats) {
Expand Down
Loading
Loading