Crate bitcoin_banman

source ·

Structs

  • | Access to the banlist database (banlist.json) |
  • | Banman manages two related but distinct | concepts: | | 1. Banning. This is configured manually by the | user, through the setban RPC. If an address or | subnet is banned, we never accept incoming | connections from it and never create outgoing | connections to it. We won’t gossip its address | to other peers in addr messages. Banned | addresses and subnets are stored to disk on | shutdown and reloaded on startup. Banning can | be used to prevent connections with spy nodes | or other griefers. | | 2. Discouragement. If a peer misbehaves enough | (see Misbehaving() in net_processing.cpp), | we’ll mark that address as discouraged. We | still allow incoming connections from them, but | they’re preferred for eviction when we receive | new incoming connections. We never make | outgoing connections to them, and do not gossip | their address to other peers. This is | implemented as a bloom filter. We can | (probabilistically) test for membership, but | can’t list all discouraged addresses or unmark | them as discouraged. Discouragement can prevent | our limited connection slots being used up by | incompatible or broken peers. | | Neither banning nor discouragement are | protections against denial-of-service attacks, | since if an attacker has a way to waste our | resources and we disconnect from them and ban | that address, it’s trivial for them to | reconnect from another IP address. | | Attempting to automatically disconnect or ban | any class of peer carries the risk of splitting | the network. For example, if we | banned/disconnected for a transaction that | fails a policy check and a future version | changes the policy check so the transaction is | accepted, then that transaction could cause the | network to split between old nodes and new | nodes.

Constants

Functions

  • | Convert a JSON array to a banmap_t | object. | | ———– | @param[in] bans_json | | JSON to convert, must be as returned | by BanMapToJson(). | ––––– | @param[out] bans | | Bans list to create from the JSON. @throws | std::runtime_error if the JSON does | not have the expected fields or they | contain unparsable values. |
  • | Convert a banmap_t object to a JSON | array. | | ———– | @param[in] bans | | Bans list to convert. | | ———– | @return | | a JSON array, similar to the one returned | by the listbanned RPC. Suitable for | passing to BanMapFromJson(). |
  • | Parse and resolve a specified subnet | string into the appropriate internal | representation. | | ———– | @param strSubnet | | A string representation of a subnet | of the form network address [ "/", ( | CIDR-style suffix | netmask ) ](e.g. | 2001:db8::/32, 192.0.2.0/255.255.255.0, | or 8.8.8.8). | | ———– | @return | | Whether the operation succeeded or | not. |

Type Definitions