Skip to content

Commit 3c7c283

Browse files
Merge pull request dashpay#5771 from vijaydasmp/bp22_10_1
backport: Merge bitcoin#19316, (Partial) 19725, 19724
2 parents e8ea36c + aa74d0b commit 3c7c283

File tree

16 files changed

+383
-223
lines changed

16 files changed

+383
-223
lines changed

doc/release-notes-19725.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Updated RPC
2+
--------
3+
4+
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.

src/chainparams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class CMainParams : public CChainParams {
252252

253253
// Note that of those which support the service bits prefix, most only support a subset of
254254
// possible options.
255-
// This is fine at runtime as we'll fall back to using them as a oneshot if they don't support the
255+
// This is fine at runtime as we'll fall back to using them as an addrfetch if they don't support the
256256
// service bits we want, but we should get them updated to support all service bits wanted by any
257257
// release ASAP to avoid it where possible.
258258
vSeeds.emplace_back("dnsseed.dash.org");

src/evo/mnauth.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ void CMNAuth::PushMNAUTH(CNode& peer, CConnman& connman, const CBlockIndex* tip)
4444
const bool is_basic_scheme_active{DeploymentActiveAfter(tip, Params().GetConsensus(), Consensus::DEPLOYMENT_V19)};
4545
const CBLSPublicKeyVersionWrapper pubKey(*activeMasternodeInfo.blsPubKeyOperator, !is_basic_scheme_active);
4646
if (peer.nVersion < MNAUTH_NODE_VER_VERSION || nOurNodeVersion < MNAUTH_NODE_VER_VERSION) {
47-
signHash = ::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.fInbound));
47+
signHash = ::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.IsInboundConn()));
4848
} else {
49-
signHash = ::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.fInbound, nOurNodeVersion));
49+
signHash = ::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.IsInboundConn(), nOurNodeVersion));
5050
}
5151

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

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

127-
if (!peer.fInbound) {
127+
if (!peer.IsInboundConn()) {
128128
mmetaman->GetMetaInfo(mnauth.proRegTxHash)->SetLastOutboundSuccess(GetTime<std::chrono::seconds>().count());
129129
if (peer.m_masternode_probe_connection) {
130130
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- Masternode probe successful for %s, disconnecting. peer=%d\n",
@@ -150,18 +150,18 @@ void CMNAuth::ProcessMessage(CNode& peer, PeerManager& peerman, CConnman& connma
150150
if (deterministicOutbound == myProTxHash) {
151151
// NOTE: do not drop inbound nodes here, mark them as probes so that
152152
// they would be disconnected later in CMasternodeUtils::DoMaintenance
153-
if (pnode2->fInbound) {
153+
if (pnode2->IsInboundConn()) {
154154
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- marking old inbound for dropping it later, peer=%d\n", pnode2->GetId());
155155
pnode2->m_masternode_probe_connection = true;
156-
} else if (peer.fInbound) {
156+
} else if (peer.IsInboundConn()) {
157157
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- marking new inbound for dropping it later, peer=%d\n", peer.GetId());
158158
peer.m_masternode_probe_connection = true;
159159
}
160160
} else {
161-
if (!pnode2->fInbound) {
161+
if (!pnode2->IsInboundConn()) {
162162
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- dropping old outbound, peer=%d\n", pnode2->GetId());
163163
pnode2->fDisconnect = true;
164-
} else if (!peer.fInbound) {
164+
} else if (!peer.IsInboundConn()) {
165165
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- dropping new outbound, peer=%d\n", peer.GetId());
166166
peer.fDisconnect = true;
167167
}

src/governance/governance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ int CGovernanceManager::RequestGovernanceObjectVotes(Span<CNode*> vNodesCopy, CC
12741274
// Don't try to sync any data from outbound non-relay "masternode" connections.
12751275
// Inbound connection this early is most likely a "masternode" connection
12761276
// initiated from another node, so skip it too.
1277-
if (!pnode->CanRelay() || (fMasternodeMode && pnode->fInbound)) continue;
1277+
if (!pnode->CanRelay() || (fMasternodeMode && pnode->IsInboundConn())) continue;
12781278
// stop early to prevent setAskFor overflow
12791279
{
12801280
LOCK(cs_main);

src/llmq/instantsend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ void CInstantSendManager::AskNodesForLockedTx(const uint256& txid, const CConnma
14651465
if (nodesToAskFor.size() >= 4) {
14661466
return;
14671467
}
1468-
if (pnode->IsAddrRelayPeer()) {
1468+
if (pnode->RelayAddrsWithConn()) {
14691469
LOCK(pnode->m_tx_relay->cs_tx_inventory);
14701470
if (pnode->m_tx_relay->filterInventoryKnown.contains(txid)) {
14711471
pnode->AddRef();

src/masternode/sync.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ void CMasternodeSync::ProcessTick()
157157
// Don't try to sync any data from outbound non-relay "masternode" connections.
158158
// Inbound connection this early is most likely a "masternode" connection
159159
// initiated from another node, so skip it too.
160-
if (!pnode->CanRelay() || (fMasternodeMode && pnode->fInbound)) continue;
160+
if (!pnode->CanRelay() || (fMasternodeMode && pnode->IsInboundConn())) continue;
161161

162162
{
163-
if ((pnode->HasPermission(PF_NOBAN) || pnode->m_manual_connection) && !netfulfilledman->HasFulfilledRequest(pnode->addr, strAllow)) {
163+
if ((pnode->HasPermission(PF_NOBAN) || pnode->IsManualConn()) && !netfulfilledman->HasFulfilledRequest(pnode->addr, strAllow)) {
164164
netfulfilledman->RemoveAllFulfilledRequests(pnode->addr);
165165
netfulfilledman->AddFulfilledRequest(pnode->addr, strAllow);
166166
LogPrintf("CMasternodeSync::ProcessTick -- skipping mnsync restrictions for peer=%d\n", pnode->GetId());
@@ -203,7 +203,7 @@ void CMasternodeSync::ProcessTick()
203203
// Now that the blockchain is synced request the mempool from the connected outbound nodes if possible
204204
for (auto pNodeTmp : vNodesCopy) {
205205
bool fRequestedEarlier = netfulfilledman->HasFulfilledRequest(pNodeTmp->addr, "mempool-sync");
206-
if (pNodeTmp->nVersion >= 70216 && !pNodeTmp->fInbound && !fRequestedEarlier && !pNodeTmp->IsBlockRelayOnly()) {
206+
if (pNodeTmp->nVersion >= 70216 && !pNodeTmp->IsInboundConn() && !fRequestedEarlier && !pNodeTmp->IsBlockRelayOnly()) {
207207
netfulfilledman->AddFulfilledRequest(pNodeTmp->addr, "mempool-sync");
208208
connman.PushMessage(pNodeTmp, msgMaker.Make(NetMsgType::MEMPOOL));
209209
LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- syncing mempool from peer=%d\n", nTick, nCurrentAsset, pNodeTmp->GetId());

src/masternode/utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ void CMasternodeUtils::DoMaintenance(CConnman& connman, const CMasternodeSync& m
3030
// Don't disconnect masternode connections when we have less then the desired amount of outbound nodes
3131
int nonMasternodeCount = 0;
3232
connman.ForEachNode(CConnman::AllNodes, [&](CNode* pnode) {
33-
if ((!pnode->fInbound &&
34-
!pnode->fFeeler &&
35-
!pnode->m_manual_connection &&
33+
if ((!pnode->IsInboundConn() &&
34+
!pnode->IsFeelerConn() &&
35+
!pnode->IsManualConn() &&
3636
!pnode->m_masternode_connection &&
3737
!pnode->m_masternode_probe_connection)
3838
||
@@ -62,7 +62,7 @@ void CMasternodeUtils::DoMaintenance(CConnman& connman, const CMasternodeSync& m
6262
return;
6363
}
6464
// keep _verified_ inbound connections
65-
if (pnode->fInbound) {
65+
if (pnode->IsInboundConn()) {
6666
return;
6767
}
6868
} else if (GetSystemTimeInSeconds() - pnode->nTimeConnected < 5) {

0 commit comments

Comments
 (0)