ConnectionManager¶
ConnectionManager¶
- class ConnectionManager(**kwargs)¶
Implements the connectionmanager api endpoints.
- addnode(ipaddr: str, command: str, **kwargs) bool ¶
Interface for the addnode command. Can continuously try to addnode, remove node, or onetry a node connection.
- Parameters:
ipaddr (str) – The endpoint.
command (str) – Allowed commands [add, remove, onetry]
**kwargs – Extra keyword arguments.
- Returns:
If command was successful.
- Return type:
bool
- Raises:
APIError – Error thrown by node API. See message for details.
- getpeerinfo(**kwargs) List[PeerInfoModel] ¶
Gets the peer info.
- Parameters:
**kwargs – Extra keyword arguments.
- Returns:
A list of connected peers.
- Return type:
List[PeerInfoModel]
- Raises:
APIError – Error thrown by node API. See message for details.
PeerInfoModel¶
- class PeerInfoModel(*, id: int, addr: str, addrlocal: str, services: str, relaytxes: bool, lastsend: int, lastrecv: int, bytessent: int, bytesrecv: int, conntime: int, timeoffset: int, pingtime: int, minping: int, pingwait: int, version: int, subver: str, inbound: bool, addnode: bool, startingheight: int, banscore: int, synced_headers: int, synced_blocks: int, whitelisted: bool, inflight: bool = None, bytessent_per_msg: int = None, bytesrecv_per_msg: int = None)¶
A pydantic model with power information..
- peer_id: int¶
The peer id.
- addr: str¶
The peer address.
- addrlocal: str¶
The local peer address.
- services: str¶
Peer services.
- relaytxes: bool¶
Relay transactions.
- lastsend: int¶
Last send.
- lastrecv: int¶
Last received.
- bytessent: int¶
Bytes sent.
- bytesrecv: int¶
Bytes received.
- conntime: int¶
Connection time in seconds.
- timeoffset: int¶
The peer time offset in seconds.
- pingtime: int¶
The ping time in ms.
- minping: int¶
The minimum ping time.
- pingwait: int¶
The point wait time.
- version: int¶
The peer version
- subver: str¶
The peer subversion.
- inbound: bool¶
Inbound connected peer.
- addnode: bool¶
If true, peer was connected by addnode.
- starting_height: int¶
Connection starting height.
- banscore: int¶
The peer’s ban score.
- synced_headers: int¶
The number of synced headers.
- synced_blocks: int¶
The number of synced blocks.
- whitelisted: bool¶
If true, peer is whitelisted.
- inflight: bool | None¶
Inflight peer.
- bytessent_per_msg: int | None¶
Bytes sent per message.
- bytesrecv_per_msg: int | None¶
Bytes received per message.