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).
Severity: LOW (cleanup / maintainability)
Component:
services/legacy/netsync/handle_block.goSummary
services/legacy/netsync/handle_block.gocontains two similarly-named functions that are easy to confuse:extendTransactions(plural) — the active path, called byprepareSubtreesduring block import (handle_block.go:417).ExtendTransaction(singular,handle_block.go:1741) — has no production caller; referenced only by unit tests.The legacy
prepareTxsPerLevelhelper (handle_block.go:1696) is in the same state — only referenced by tests in this package; it is unrelated to the actively-usedprepareTxsPerLevelinservices/subtreevalidation(different signature/receiver).ExtendTransactionstill carries the oldIsExtended()parent-wait spin-loop with a hardcoded120 * time.Secondtimeout — the exact pattern that was removed from the activeextendTransactionsby #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
ExtendTransactionand was mistaken for the active path.Proposed cleanup
ExtendTransaction(handle_block.go:1741).prepareTxsPerLevel(handle_block.go:1696) if it has no remaining production use after the above.services/legacy/netsync/handle_block_test.go(lines ~168, 626, 686, 830)stores/utxo/aerospike/get_test.go(line ~295 — usessm.ExtendTransactionas a cross-package test helper; needs a replacement or removal)Acceptance criteria
go build ./...and the affected packages' tests pass (services/legacy/netsync,stores/utxo/aerospike).120 * time.Secondparent-wait loop remains anywhere inhandle_block.go.Context
Follow-up from #883 (closed as already-fixed by #722).