Skip to content

Commit 1eff91b

Browse files
committed
Fixed Master Merge Conflict
1 parent 560d2bd commit 1eff91b

File tree

6 files changed

+9
-93
lines changed

6 files changed

+9
-93
lines changed

src/net.cpp

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,40 +1011,18 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
10111011
// on all platforms. Set it again here just to be sure.
10121012
SetSocketNoDelay(hSocket);
10131013

1014-
<<<<<<< HEAD
1015-
<<<<<<< HEAD
10161014
// Don't accept connections from banned peers.
10171015
bool banned = m_banman->IsBanned(addr);
10181016
if (!NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_NOBAN) && banned)
1019-
=======
1020-
int bannedlevel = m_banman ? m_banman->IsBannedLevel(addr) : 0;
1021-
1022-
// Don't accept connections from banned peers.
1023-
if (!NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_NOBAN) && bannedlevel == 2)
1024-
>>>>>>> Replace automatic bans with discouragement filter
1025-
=======
1026-
// Don't accept connections from banned peers.
1027-
bool banned = m_banman->IsBanned(addr);
1028-
if (!NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_NOBAN) && banned)
1029-
>>>>>>> Clean up separated ban/discourage interface
10301017
{
10311018
LogPrint(BCLog::NET, "connection from %s dropped (banned)\n", addr.ToString());
10321019
CloseSocket(hSocket);
10331020
return;
10341021
}
10351022

10361023
// Only accept connections from discouraged peers if our inbound slots aren't (almost) full.
1037-
<<<<<<< HEAD
1038-
<<<<<<< HEAD
1039-
bool discouraged = m_banman->IsDiscouraged(addr);
1040-
if (!NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_NOBAN) && nInbound + 1 >= nMaxInbound && discouraged)
1041-
=======
1042-
if (!NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_NOBAN) && nInbound + 1 >= nMaxInbound && bannedlevel >= 1)
1043-
>>>>>>> Replace automatic bans with discouragement filter
1044-
=======
10451024
bool discouraged = m_banman->IsDiscouraged(addr);
1046-
if (!NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_NOBAN) && nInbound + 1 >= nMaxInbound && discouraged)
1047-
>>>>>>> Clean up separated ban/discourage interface
1025+
if (!NetPermissions::HasFlag(permissionFlags, NetPermissionFlags::PF_NOBAN) && nInbound + 1 >= nMaxInbound && discouraged)
10481026
{
10491027
LogPrint(BCLog::NET, "connection from %s dropped (discouraged)\n", addr.ToString());
10501028
CloseSocket(hSocket);

src/net_permissions.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,8 @@ enum NetPermissionFlags {
2323
// Always relay transactions from this peer, even if already in mempool
2424
// Keep parameter interaction: forcerelay implies relay
2525
PF_FORCERELAY = (1U << 2) | PF_RELAY,
26-
<<<<<<< HEAD
27-
// Allow getheaders during IBD and block-download after maxuploadtarget limit
28-
PF_DOWNLOAD = (1U << 6),
29-
// Can't be banned/disconnected/discouraged for misbehavior
30-
PF_NOBAN = (1U << 4) | PF_DOWNLOAD,
31-
=======
3226
// Can't be banned/disconnected/discouraged for misbehavior
3327
PF_NOBAN = (1U << 4),
34-
>>>>>>> Clean up separated ban/discourage interface
3528
// Can query the mempool
3629
PF_MEMPOOL = (1U << 5),
3730

src/net_processing.cpp

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,15 +1033,7 @@ void Misbehaving(NodeId pnode, int howmuch, const std::string& message) EXCLUSIV
10331033
if (state->nMisbehavior >= banscore && state->nMisbehavior - howmuch < banscore)
10341034
{
10351035
LogPrint(BCLog::NET, "%s: %s peer=%d (%d -> %d) DISCOURAGE THRESHOLD EXCEEDED%s\n", __func__, state->name, pnode, state->nMisbehavior-howmuch, state->nMisbehavior, message_prefixed);
1036-
<<<<<<< HEAD
1037-
<<<<<<< HEAD
1038-
state->m_should_discourage = true;
1039-
=======
1040-
state->fShouldBan = true;
1041-
>>>>>>> Replace automatic bans with discouragement filter
1042-
=======
1043-
state->m_should_discourage = true;
1044-
>>>>>>> Clean up separated ban/discourage interface
1036+
state->m_should_discourage = true;
10451037
} else
10461038
LogPrint(BCLog::NET, "%s: %s peer=%d (%d -> %d)%s\n", __func__, state->name, pnode, state->nMisbehavior-howmuch, state->nMisbehavior, message_prefixed);
10471039
}
@@ -3582,28 +3574,12 @@ bool PeerLogicValidation::MaybeDiscourageAndDisconnect(CNode& pnode)
35823574
LogPrintf("Warning: not punishing whitelisted peer %s!\n", pnode.addr.ToString());
35833575
} else if (pnode.m_manual_connection) {
35843576
LogPrintf("Warning: not punishing manually-connected peer %s!\n", pnode.addr.ToString());
3585-
<<<<<<< HEAD
3586-
<<<<<<< HEAD
3587-
} else if (pnode.addr.IsLocal()) {
3588-
=======
3589-
else if (pnode.addr.IsLocal()) {
3590-
>>>>>>> Replace automatic bans with discouragement filter
3591-
=======
3592-
} else if (pnode.addr.IsLocal()) {
3593-
>>>>>>> Clean up separated ban/discourage interface
3577+
} else if (pnode.addr.IsLocal()) {
35943578
// Disconnect but don't discourage this local node
35953579
LogPrintf("Warning: disconnecting but not discouraging local peer %s!\n", pnode.addr.ToString());
35963580
pnode.fDisconnect = true;
3597-
} else {
3598-
<<<<<<< HEAD
3599-
<<<<<<< HEAD
3600-
// Disconnect and discourage all nodes sharing the address
3601-
=======
3602-
// Disconnect and ban all nodes sharing the address
3603-
>>>>>>> Replace automatic bans with discouragement filter
3604-
=======
3605-
// Disconnect and discourage all nodes sharing the address
3606-
>>>>>>> Clean up separated ban/discourage interface
3581+
} else {
3582+
// Disconnect and discourage all nodes sharing the address
36073583
LogPrintf("Disconnecting and discouraging peer %s!\n", pnode.addr.ToString());
36083584
if (m_banman) {
36093585
m_banman->Discourage(pnode.addr);

src/rpc/blockchain.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -976,15 +976,7 @@ static UniValue gettxoutsetinfo(const JSONRPCRequest& request)
976976
"\nReturns statistics about the unspent transaction output set.\n"
977977
"Note this call may take some time.\n",
978978
{
979-
<<<<<<< HEAD
980-
<<<<<<< HEAD
981979
{"hash_type", RPCArg::Type::STR, /* default */ "hash_serialized_2", "Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm), 'none'."},
982-
=======
983-
{"hash_type", RPCArg::Type::STR, /* default */ "hash_serialized_2", "Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm)."},
984-
>>>>>>> rpc: gettxoutsetinfo can specify hash_type (only legacy option for now)
985-
=======
986-
{"hash_type", RPCArg::Type::STR, /* default */ "hash_serialized_2", "Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm), 'none'."},
987-
>>>>>>> rpc: Add hash_type NONE to gettxoutsetinfo
988980
},
989981
RPCResult{
990982
RPCResult::Type::OBJ, "", "",
@@ -2331,15 +2323,7 @@ UniValue dumptxoutset(const JSONRPCRequest& request)
23312323

23322324
::ChainstateActive().ForceFlushStateToDisk();
23332325

2334-
<<<<<<< HEAD
2335-
<<<<<<< HEAD
2336-
if (!GetUTXOStats(&::ChainstateActive().CoinsDB(), stats, CoinStatsHashType::NONE, RpcInterruptionPoint)) {
2337-
=======
2338-
if (!GetUTXOStats(&::ChainstateActive().CoinsDB(), stats, CoinStatsHashType::HASH_SERIALIZED, RpcInterruptionPoint)) {
2339-
>>>>>>> rpc: gettxoutsetinfo can specify hash_type (only legacy option for now)
2340-
=======
2341-
if (!GetUTXOStats(&::ChainstateActive().CoinsDB(), stats, CoinStatsHashType::NONE, RpcInterruptionPoint)) {
2342-
>>>>>>> rpc: Add hash_type NONE to gettxoutsetinfo
2326+
if (!GetUTXOStats(&::ChainstateActive().CoinsDB(), stats, CoinStatsHashType::NONE, RpcInterruptionPoint)) {
23432327
throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to read UTXO set");
23442328
}
23452329

src/rpc/util.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,8 @@ CoinStatsHashType ParseHashType(const UniValue& param, const CoinStatsHashType d
122122

123123
if (hash_type_input == "hash_serialized_2") {
124124
return CoinStatsHashType::HASH_SERIALIZED;
125-
<<<<<<< HEAD
126-
<<<<<<< HEAD
127125
} else if (hash_type_input == "none") {
128-
return CoinStatsHashType::NONE;
129-
=======
130-
>>>>>>> rpc: gettxoutsetinfo can specify hash_type (only legacy option for now)
131-
=======
132-
} else if (hash_type_input == "none") {
133-
return CoinStatsHashType::NONE;
134-
>>>>>>> rpc: Add hash_type NONE to gettxoutsetinfo
126+
return CoinStatsHashType::NONE;
135127
} else {
136128
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%d is not a valid hash_type", hash_type_input));
137129
}

src/test/denialofservice_tests.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,8 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
344344
LOCK2(cs_main, dummyNode.cs_sendProcessing);
345345
BOOST_CHECK(peerLogic->SendMessages(&dummyNode));
346346
}
347-
<<<<<<< HEAD
348-
<<<<<<< HEAD
349-
BOOST_CHECK(banman->IsDiscouraged(addr));
350-
=======
351-
BOOST_CHECK(banman->IsBanned(addr));
352-
>>>>>>> Replace automatic bans with discouragement filter
353-
=======
354-
BOOST_CHECK(banman->IsDiscouraged(addr));
355-
>>>>>>> Clean up separated ban/discourage interface
347+
348+
BOOST_CHECK(banman->IsDiscouraged(addr));
356349

357350
bool dummy;
358351
peerLogic->FinalizeNode(dummyNode.GetId(), dummy);

0 commit comments

Comments
 (0)