Conversation
317787106
force-pushed
the
feature/admin_rpc
branch
from
September 16, 2026 14:43
6aad258 to
b3a7b20
Compare
Add peer management to Admin HTTP and IPC, including active-peer inspection, persistent IP blocking, and optional IPC text output. Implement the management APIs and TCP connection policy in the built-in p2p module. Retain the standalone blocked-ips option and consolidate its tests in StartAppArgsTest. Base the change on feature/admin_rpc with java-tron 4.8.3.
317787106
force-pushed
the
feature/peer_management
branch
from
September 29, 2026 08:28
2c73224 to
1909dcc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds runtime peer management to Admin JSON-RPC over HTTP and IPC, so operators can adjust active nodes, inspect connections, and block malicious IPs without restarting FullNode.
The API adds
admin_addPeer,admin_removePeer,admin_disconnectPeer,admin_listActivePeers,admin_blockIp,admin_unblockIp, andadmin_listBlockedIps. Mutations return a sharedPeerOperationResult; active-peer queries reuse the connection, latency, and synchronization statistics used byPeerConnection.log(). The IPC client also supports optional text-table output foradmin_listActivePeers.Why are these changes required?
Operators need to disconnect or block identified malicious peers and add trusted endpoints promptly when investigating degraded connectivity or network isolation. Persistent manual IP blocking keeps those decisions effective across node restarts.
Integration with the built-in p2p module
Upstream PR #6992 has merged libp2p into java-tron as the local
:p2pmodule. This PR targetsfeature/admin_rpc, which already includes that change fromrelease_v4.8.3, and contains both the framework integration and the required p2p implementation and tests. It has no dependency on a separate libp2p PR, SNAPSHOT artifact, or release.frameworkowns Admin HTTP/IPC dispatch, operation coordination, peer statistics, and persistence of normalized IPs andblockedAtMillistimestamps inCommonStore["blocked-ips"].p2pprovidesaddActiveNode,removeActiveNode,disconnect, andreplaceBlockedIps, plus TCP admission, dialing, candidate filtering, and disconnection enforcement.ConnectionPolicypublishes an immutable IP set through a volatile reference and normalizes IPv4-mapped IPv6 addresses for matching.P2pConfig.blockedIpssupplies the initial policy; runtime changes update the policy without writing back to startup configuration.p2p-standalone.jarretains--blocked-ips/-b. Its argument coverage is consolidated inStartAppArgsTest, and the module README documents startup and runtime usage.Behavior and compatibility
admin_addPeeradds an active endpoint without adding it totrustNodesor waiting for a successful connection. Adding a blocked IP is rejected.admin_removePeerremoves the active endpoint and closes its connection.admin_disconnectPeeronly closes the current connection; an active node can reconnect later.node.dynamicConfig.enableis enabled, add/remove operations return a structured failure directing operators to updatenode.active. Other peer-management operations remain available.Connect.protoaddsDisconnectReason.REQUESTED = 0x0Ffor explicit disconnects. The existing disconnect message structure, consensus rules, and chain-data formats remain unchanged.Testing
p2psuite: 383 tests, 3 existing skips, no failures or errors;StartAppArgsTestincludes all 11 argument tests.frameworksuites: 197 tests, no failures or errors.checkstyleMainandcheckstyleTestpassed.:p2p:buildStandaloneJarand a standalone JAR help invocation with--blocked-ipspassed.