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.

  • 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. Dec 8 '11 at 21:27
  • Why not title this as "Does the main Bitcoin client blacklist addresses?"
    – ripper234
    Dec 9 '11 at 8:12

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
            if (setBanned[addr.ip] < banTime)
                setBanned[addr.ip] = banTime;
        printf("Disconnected %s for misbehavior (score=%d)\n", addr.ToString().c_str(), nMisbehavior);
        return true;
    return false;
  • 3
    Setting -banscore=999999 (or some other very-large number) would be another way of getting bitcoin to be very forgiving when developing an app. Dec 10 '11 at 6:16
  • 2
    What determines misbehavior?
    – Geremia
    May 20 '16 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.