@@ -157,9 +157,6 @@ std::map<uint256, std::map<uint256, COrphanTx>::iterator> g_orphans_by_wtxid GUA
157
157
158
158
void EraseOrphansFor (NodeId peer);
159
159
160
- /* * Increase a node's misbehavior score. */
161
- void Misbehaving (NodeId nodeid, int howmuch, const std::string& message=" " ) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
162
-
163
160
// Internal stuff
164
161
namespace {
165
162
/* * Number of nodes with fSyncStarted. */
@@ -1799,7 +1796,7 @@ inline void static SendBlockTransactions(const CBlock& block, const BlockTransac
1799
1796
for (size_t i = 0 ; i < req.indexes .size (); i++) {
1800
1797
if (req.indexes [i] >= block.vtx .size ()) {
1801
1798
LOCK (cs_main);
1802
- Misbehaving (pfrom.GetId (), 100 , strprintf ( " Peer %d sent us a getblocktxn with out-of-bounds tx indices" , pfrom. GetId ()) );
1799
+ Misbehaving (pfrom.GetId (), 100 , " getblocktxn with out-of-bounds tx indices" );
1803
1800
return ;
1804
1801
}
1805
1802
resp.txn [i] = block.vtx [req.indexes [i]];
@@ -1848,7 +1845,7 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
1848
1845
UpdateBlockAvailability (pfrom.GetId (), headers.back ().GetHash ());
1849
1846
1850
1847
if (nodestate->nUnconnectingHeaders % MAX_UNCONNECTING_HEADERS == 0 ) {
1851
- Misbehaving (pfrom.GetId (), 20 );
1848
+ Misbehaving (pfrom.GetId (), 20 , strprintf ( " %d non-connecting headers " , nodestate-> nUnconnectingHeaders ) );
1852
1849
}
1853
1850
return ;
1854
1851
}
@@ -2307,7 +2304,7 @@ void ProcessMessage(
2307
2304
if (pfrom.nVersion != 0 )
2308
2305
{
2309
2306
LOCK (cs_main);
2310
- Misbehaving (pfrom.GetId (), 1 );
2307
+ Misbehaving (pfrom.GetId (), 1 , " redundant version message " );
2311
2308
return ;
2312
2309
}
2313
2310
@@ -2468,7 +2465,7 @@ void ProcessMessage(
2468
2465
if (pfrom.nVersion == 0 ) {
2469
2466
// Must have a version message before anything else
2470
2467
LOCK (cs_main);
2471
- Misbehaving (pfrom.GetId (), 1 );
2468
+ Misbehaving (pfrom.GetId (), 1 , " non-version message before version handshake " );
2472
2469
return ;
2473
2470
}
2474
2471
@@ -2535,7 +2532,7 @@ void ProcessMessage(
2535
2532
if (!pfrom.fSuccessfullyConnected ) {
2536
2533
// Must have a verack message before anything else
2537
2534
LOCK (cs_main);
2538
- Misbehaving (pfrom.GetId (), 1 );
2535
+ Misbehaving (pfrom.GetId (), 1 , " non-verack message before version handshake " );
2539
2536
return ;
2540
2537
}
2541
2538
@@ -3203,7 +3200,7 @@ void ProcessMessage(
3203
3200
ReadStatus status = partialBlock.InitData (cmpctblock, vExtraTxnForCompact);
3204
3201
if (status == READ_STATUS_INVALID) {
3205
3202
MarkBlockAsReceived (pindex->GetBlockHash ()); // Reset in-flight state in case Misbehaving does not result in a disconnect
3206
- Misbehaving (pfrom.GetId (), 100 , strprintf ( " Peer %d sent us invalid compact block\n " , pfrom. GetId ()) );
3203
+ Misbehaving (pfrom.GetId (), 100 , " invalid compact block" );
3207
3204
return ;
3208
3205
} else if (status == READ_STATUS_FAILED) {
3209
3206
// Duplicate txindexes, the block is now in-flight, so just request it
@@ -3336,7 +3333,7 @@ void ProcessMessage(
3336
3333
ReadStatus status = partialBlock.FillBlock (*pblock, resp.txn );
3337
3334
if (status == READ_STATUS_INVALID) {
3338
3335
MarkBlockAsReceived (resp.blockhash ); // Reset in-flight state in case Misbehaving does not result in a disconnect
3339
- Misbehaving (pfrom.GetId (), 100 , strprintf ( " Peer %d sent us invalid compact block/non-matching block transactions\n " , pfrom. GetId ()) );
3336
+ Misbehaving (pfrom.GetId (), 100 , " invalid compact block/non-matching block transactions" );
3340
3337
return ;
3341
3338
} else if (status == READ_STATUS_FAILED) {
3342
3339
// Might have collided, fall back to getdata now :(
@@ -3605,7 +3602,7 @@ void ProcessMessage(
3605
3602
{
3606
3603
// There is no excuse for sending a too-large filter
3607
3604
LOCK (cs_main);
3608
- Misbehaving (pfrom.GetId (), 100 );
3605
+ Misbehaving (pfrom.GetId (), 100 , " too-large bloom filter " );
3609
3606
}
3610
3607
else if (pfrom.m_tx_relay != nullptr )
3611
3608
{
@@ -3639,7 +3636,7 @@ void ProcessMessage(
3639
3636
}
3640
3637
if (bad) {
3641
3638
LOCK (cs_main);
3642
- Misbehaving (pfrom.GetId (), 100 );
3639
+ Misbehaving (pfrom.GetId (), 100 , " bad filteradd message " );
3643
3640
}
3644
3641
return ;
3645
3642
}
0 commit comments