Skip to content

[cleanup] Remove dead test-only ExtendTransaction / legacy prepareTxsPerLevel in legacy/netsync #1121

@ordishs

Description

@ordishs

Severity: LOW (cleanup / maintainability)
Component: services/legacy/netsync/handle_block.go

Summary

services/legacy/netsync/handle_block.go contains two similarly-named functions that are easy to confuse:

  • extendTransactions (plural) — the active path, called by prepareSubtrees during block import (handle_block.go:417).
  • ExtendTransaction (singular, handle_block.go:1741) — has no production caller; referenced only by unit tests.

The legacy prepareTxsPerLevel helper (handle_block.go:1696) is in the same state — only referenced by tests in this package; it is unrelated to the actively-used prepareTxsPerLevel in services/subtreevalidation (different signature/receiver).

ExtendTransaction still carries the old IsExtended() parent-wait spin-loop with a hardcoded 120 * time.Second timeout — the exact pattern that was removed from the active extendTransactions by #722 (shipped in v0.15.0) because it was unnecessary and could deadlock.

This dead code directly caused the confusion in #883, where a static line lookup landed on ExtendTransaction and was mistaken for the active path.

Proposed cleanup

  • Remove ExtendTransaction (handle_block.go:1741).
  • Remove the legacy prepareTxsPerLevel (handle_block.go:1696) if it has no remaining production use after the above.
  • Migrate or delete the unit tests that exercise them:
    • services/legacy/netsync/handle_block_test.go (lines ~168, 626, 686, 830)
    • stores/utxo/aerospike/get_test.go (line ~295 — uses sm.ExtendTransaction as a cross-package test helper; needs a replacement or removal)

Acceptance criteria

  • No production or test references to the removed functions remain.
  • go build ./... and the affected packages' tests pass (services/legacy/netsync, stores/utxo/aerospike).
  • No hardcoded 120 * time.Second parent-wait loop remains anywhere in handle_block.go.

Context

Follow-up from #883 (closed as already-fixed by #722).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions