Skip to content
Merged
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
4 changes: 4 additions & 0 deletions doc/release-notes-19725.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Updated RPC
--------

The `getpeerinfo` RPC now returns a `connection_type` field. This indicates the type of connection established with the peer. It will return one of six options. For more information, see the `getpeerinfo` help documentation.
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class CMainParams : public CChainParams {

// Note that of those which support the service bits prefix, most only support a subset of
// possible options.
// This is fine at runtime as we'll fall back to using them as a oneshot if they don't support the
// This is fine at runtime as we'll fall back to using them as an addrfetch if they don't support the
// service bits we want, but we should get them updated to support all service bits wanted by any
// release ASAP to avoid it where possible.
vSeeds.emplace_back("dnsseed.dash.org");
Expand Down
18 changes: 9 additions & 9 deletions src/evo/mnauth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ void CMNAuth::PushMNAUTH(CNode& peer, CConnman& connman, const CBlockIndex* tip)
const bool is_basic_scheme_active{DeploymentActiveAfter(tip, Params().GetConsensus(), Consensus::DEPLOYMENT_V19)};
const CBLSPublicKeyVersionWrapper pubKey(*activeMasternodeInfo.blsPubKeyOperator, !is_basic_scheme_active);
if (peer.nVersion < MNAUTH_NODE_VER_VERSION || nOurNodeVersion < MNAUTH_NODE_VER_VERSION) {
signHash = ::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.fInbound));
signHash = ::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.IsInboundConn()));
} else {
signHash = ::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.fInbound, nOurNodeVersion));
signHash = ::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.IsInboundConn(), nOurNodeVersion));
}

CMNAuth mnauth;
Expand Down Expand Up @@ -111,9 +111,9 @@ void CMNAuth::ProcessMessage(CNode& peer, PeerManager& peerman, CConnman& connma
ConstCBLSPublicKeyVersionWrapper pubKey(dmn->pdmnState->pubKeyOperator.Get(), !is_basic_scheme_active);
// See comment in PushMNAUTH (fInbound is negated here as we're on the other side of the connection)
if (peer.nVersion < MNAUTH_NODE_VER_VERSION || nOurNodeVersion < MNAUTH_NODE_VER_VERSION) {
signHash = ::SerializeHash(std::make_tuple(pubKey, peer.GetSentMNAuthChallenge(), !peer.fInbound));
signHash = ::SerializeHash(std::make_tuple(pubKey, peer.GetSentMNAuthChallenge(), !peer.IsInboundConn()));
} else {
signHash = ::SerializeHash(std::make_tuple(pubKey, peer.GetSentMNAuthChallenge(), !peer.fInbound, peer.nVersion.load()));
signHash = ::SerializeHash(std::make_tuple(pubKey, peer.GetSentMNAuthChallenge(), !peer.IsInboundConn(), peer.nVersion.load()));
}
LogPrint(BCLog::NET_NETCONN, "CMNAuth::%s -- constructed signHash for nVersion %d, peer=%d\n", __func__, peer.nVersion, peer.GetId());

Expand All @@ -124,7 +124,7 @@ void CMNAuth::ProcessMessage(CNode& peer, PeerManager& peerman, CConnman& connma
return;
}

if (!peer.fInbound) {
if (!peer.IsInboundConn()) {
mmetaman->GetMetaInfo(mnauth.proRegTxHash)->SetLastOutboundSuccess(GetTime<std::chrono::seconds>().count());
if (peer.m_masternode_probe_connection) {
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- Masternode probe successful for %s, disconnecting. peer=%d\n",
Expand All @@ -150,18 +150,18 @@ void CMNAuth::ProcessMessage(CNode& peer, PeerManager& peerman, CConnman& connma
if (deterministicOutbound == myProTxHash) {
// NOTE: do not drop inbound nodes here, mark them as probes so that
// they would be disconnected later in CMasternodeUtils::DoMaintenance
if (pnode2->fInbound) {
if (pnode2->IsInboundConn()) {
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- marking old inbound for dropping it later, peer=%d\n", pnode2->GetId());
pnode2->m_masternode_probe_connection = true;
} else if (peer.fInbound) {
} else if (peer.IsInboundConn()) {
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- marking new inbound for dropping it later, peer=%d\n", peer.GetId());
peer.m_masternode_probe_connection = true;
}
} else {
if (!pnode2->fInbound) {
if (!pnode2->IsInboundConn()) {
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- dropping old outbound, peer=%d\n", pnode2->GetId());
pnode2->fDisconnect = true;
} else if (!peer.fInbound) {
} else if (!peer.IsInboundConn()) {
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- dropping new outbound, peer=%d\n", peer.GetId());
peer.fDisconnect = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/governance/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ int CGovernanceManager::RequestGovernanceObjectVotes(Span<CNode*> vNodesCopy, CC
// Don't try to sync any data from outbound non-relay "masternode" connections.
// Inbound connection this early is most likely a "masternode" connection
// initiated from another node, so skip it too.
if (!pnode->CanRelay() || (fMasternodeMode && pnode->fInbound)) continue;
if (!pnode->CanRelay() || (fMasternodeMode && pnode->IsInboundConn())) continue;
// stop early to prevent setAskFor overflow
{
LOCK(cs_main);
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ void CInstantSendManager::AskNodesForLockedTx(const uint256& txid, const CConnma
if (nodesToAskFor.size() >= 4) {
return;
}
if (pnode->IsAddrRelayPeer()) {
if (pnode->RelayAddrsWithConn()) {
LOCK(pnode->m_tx_relay->cs_tx_inventory);
if (pnode->m_tx_relay->filterInventoryKnown.contains(txid)) {
pnode->AddRef();
Expand Down
6 changes: 3 additions & 3 deletions src/masternode/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ void CMasternodeSync::ProcessTick()
// Don't try to sync any data from outbound non-relay "masternode" connections.
// Inbound connection this early is most likely a "masternode" connection
// initiated from another node, so skip it too.
if (!pnode->CanRelay() || (fMasternodeMode && pnode->fInbound)) continue;
if (!pnode->CanRelay() || (fMasternodeMode && pnode->IsInboundConn())) continue;

{
if ((pnode->HasPermission(PF_NOBAN) || pnode->m_manual_connection) && !netfulfilledman->HasFulfilledRequest(pnode->addr, strAllow)) {
if ((pnode->HasPermission(PF_NOBAN) || pnode->IsManualConn()) && !netfulfilledman->HasFulfilledRequest(pnode->addr, strAllow)) {
netfulfilledman->RemoveAllFulfilledRequests(pnode->addr);
netfulfilledman->AddFulfilledRequest(pnode->addr, strAllow);
LogPrintf("CMasternodeSync::ProcessTick -- skipping mnsync restrictions for peer=%d\n", pnode->GetId());
Expand Down Expand Up @@ -203,7 +203,7 @@ void CMasternodeSync::ProcessTick()
// Now that the blockchain is synced request the mempool from the connected outbound nodes if possible
for (auto pNodeTmp : vNodesCopy) {
bool fRequestedEarlier = netfulfilledman->HasFulfilledRequest(pNodeTmp->addr, "mempool-sync");
if (pNodeTmp->nVersion >= 70216 && !pNodeTmp->fInbound && !fRequestedEarlier && !pNodeTmp->IsBlockRelayOnly()) {
if (pNodeTmp->nVersion >= 70216 && !pNodeTmp->IsInboundConn() && !fRequestedEarlier && !pNodeTmp->IsBlockRelayOnly()) {
netfulfilledman->AddFulfilledRequest(pNodeTmp->addr, "mempool-sync");
connman.PushMessage(pNodeTmp, msgMaker.Make(NetMsgType::MEMPOOL));
LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- syncing mempool from peer=%d\n", nTick, nCurrentAsset, pNodeTmp->GetId());
Expand Down
8 changes: 4 additions & 4 deletions src/masternode/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ void CMasternodeUtils::DoMaintenance(CConnman& connman, const CMasternodeSync& m
// Don't disconnect masternode connections when we have less then the desired amount of outbound nodes
int nonMasternodeCount = 0;
connman.ForEachNode(CConnman::AllNodes, [&](CNode* pnode) {
if ((!pnode->fInbound &&
!pnode->fFeeler &&
!pnode->m_manual_connection &&
if ((!pnode->IsInboundConn() &&
!pnode->IsFeelerConn() &&
!pnode->IsManualConn() &&
!pnode->m_masternode_connection &&
!pnode->m_masternode_probe_connection)
||
Expand Down Expand Up @@ -62,7 +62,7 @@ void CMasternodeUtils::DoMaintenance(CConnman& connman, const CMasternodeSync& m
return;
}
// keep _verified_ inbound connections
if (pnode->fInbound) {
if (pnode->IsInboundConn()) {
return;
}
} else if (GetSystemTimeInSeconds() - pnode->nTimeConnected < 5) {
Expand Down
Loading