<p>There is a ban mechanism which is handled in <code>net.cpp</code>.</p>

<p>Any node which misbehave by more than <code>-banscore</code> (defaults to 100) is banned for <code>-bantime</code> (defaults to 60×60×24 seconds = 1 day).
However, nodes with a local ip address are exempted, and for those a warning is shown in the logs after each misbehavior.</p>

<p>Also bans are not persistent, they are lifted when the client is restarted.</p>

<p>So, during development, just make sure that your app connects with a local address to the bitcoin client, and you will not be bothered by bans.</p>

<hr>

<p>Here is the relevant piece of code:</p>



<pre><code>bool CNode::Misbehaving(int howmuch)
{
    if (addr.IsLocal())
    {
        printf("Warning: local node %s misbehaving\n", addr.ToString().c_str());
        return false;
    }

    nMisbehavior += howmuch;
    if (nMisbehavior &gt;= GetArg("-banscore", 100))
    {
        int64 banTime = GetTime()+GetArg("-bantime", 60*60*24);  // Default 24-hour ban
        CRITICAL_BLOCK(cs_setBanned)
            if (setBanned[addr.ip] &lt; banTime)
                setBanned[addr.ip] = banTime;
        CloseSocketDisconnect();
        printf("Disconnected %s for misbehavior (score=%d)\n", addr.ToString().c_str(), nMisbehavior);
        return true;
    }
    return false;
}
</code></pre>

CC BY-SA 3.0
2016-05-20T17:28:23.040Z
What determines misbehavior?
Geremia
CC BY-SA 3.0
2011-12-10T06:16:59.310Z
Setting -banscore=999999 (or some other very-large number) would be another way of getting bitcoin to be very forgiving when developing an app.
gavinandresen
CC BY-SA 3.0
2011-12-10T00:13:14.390Z
2016-05-20T18:54:51.930Z
2016-05-20T18:54:51.930Z
Stéphane Gimenez
<p>Does the main Bitcoin client blacklist any addresses that send too many erroneous messages? If so, how can one whitelist a particular address? I am developing an app that will be communicating with the main client and I don't want the program to ban it during testing.</p>

CC BY-SA 3.0
2011-12-08T21:27:55.343Z
I don't know the answer, but there is a testnet intended for app development isn't there? It should presumably be more forgiving.
Highly Irregular
CC BY-SA 3.0
2011-12-09T08:12:53.543Z
Why not title this as "Does the main Bitcoin client blacklist addresses?"
ripper234
<bitcoin-core><security><testing><banscore>
Does the main Bitcoin client blacklist addresses?
ThePiachu
# Does the main Bitcoin client blacklist addresses?

(Asked by: username_0 on 2011-12-08)

Does the main Bitcoin client blacklist any addresses that send too many erroneous messages? If so, how can one whitelist a particular address? I am developing an app that will be communicating with the main client and I don't want the program to ban it during testing.

**Tags:** bitcoin-core, security, testing, banscore

> **Comments:**
> **username_1**: I don't know the answer, but there is a testnet intended for app development isn't there? It should presumably be more forgiving.  
> **username_2**: Why not title this as "Does the main Bitcoin client blacklist addresses?"  

---

## 1 answers

### Answer by username_3 on 2011-12-10. Score: 9 | Accepted answer

There is a ban mechanism which is handled in `net.cpp`.

Any node which misbehave by more than `-banscore` (defaults to 100) is banned for `-bantime` (defaults to 60×60×24 seconds = 1 day).
However, nodes with a local ip address are exempted, and for those a warning is shown in the logs after each misbehavior.

Also bans are not persistent, they are lifted when the client is restarted.

So, during development, just make sure that your app connects with a local address to the bitcoin client, and you will not be bothered by bans.

---

Here is the relevant piece of code:

```
bool CNode::Misbehaving(int howmuch)
{
    if (addr.IsLocal())
    {
        printf("Warning: local node %s misbehaving\n", addr.ToString().c_str());
        return false;
    }

    nMisbehavior += howmuch;
    if (nMisbehavior >= GetArg("-banscore", 100))
    {
        int64 banTime = GetTime()+GetArg("-bantime", 60*60*24);  // Default 24-hour ban
        CRITICAL_BLOCK(cs_setBanned)
            if (setBanned[addr.ip] < banTime)
                setBanned[addr.ip] = banTime;
        CloseSocketDisconnect();
        printf("Disconnected %s for misbehavior (score=%d)\n", addr.ToString().c_str(), nMisbehavior);
        return true;
    }
    return false;
}

```

> **Comments:**
> **username_5**: Setting -banscore=999999 (or some other very-large number) would be another way of getting bitcoin to be very forgiving when developing an app.  
> **username_4**: What determines misbehavior?  

---

