Skip to content

refactor: remove a deprecated KhaosDatabase overload and unused imports - #7021

Merged
kuny0707 merged 9 commits into
tronprotocol:release_v4.8.3from
Little-Peony:feature/remove-khaos-getbranch-overload
Oct 13, 2026
Merged

kuny0707 merged 9 commits into
tronprotocol:release_v4.8.3from
Little-Peony:feature/remove-khaos-getbranch-overload

Conversation

@SeriousCoding789

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Remove KhaosDatabase.getBranch(BlockId, BlockId), which is marked @Deprecated and has no callers. getBranch(Sha256Hash, Sha256Hash), which Manager uses, is unchanged.
  • Remove the 74 unused imports in production code (src/main/java): chainbase 36, framework 29, consensus 4, p2p 3, crypto 1, plugins 1. Each module is a separate commit.

Why are these changes required?

  • The overload is dead code, and it behaves differently from the remaining one: it returns empty branches when a block is not in the fork database, where getBranch(Sha256Hash, Sha256Hash) throws NonCommonBlockException. The existing call sites pass a Sha256Hash as one of the two arguments, so they already resolve to the remaining overload and keep their behavior.
  • The Checkstyle configuration has no UnusedImports rule, and chainbase, consensus, crypto and p2p do not run Checkstyle, so unused imports were never reported.

This PR has been tested by:

  • Unit Tests: main and test code of every module compile; KhaosDatabaseTest, ManagerMockTest and checkstyle (framework, plugins) pass.
  • The imports were found by scanning every tracked src/main/java file for imports whose name is not used outside comments and string literals. Imports referenced only from Javadoc {@link} are kept (UnsignedBytes in FastByteComparisons, AccountIdIndexStore in MigrateTurkishKeyHelper).

Follow up

None.

Extra details

@kuny0707
kuny0707 merged commit 9ff3596 into tronprotocol:release_v4.8.3 Oct 13, 2026
16 of 17 checks passed
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.3 milestone Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants