Skip to content

fix(bump_builder): preserve block height when publishing mined status (#87)#123

Merged
mrz1836 merged 3 commits into
mainfrom
fix/issue-87-mined-status-block-height
May 2, 2026
Merged

fix(bump_builder): preserve block height when publishing mined status (#87)#123
mrz1836 merged 3 commits into
mainfrom
fix/issue-87-mined-status-block-height

Conversation

@galt-tr
Copy link
Copy Markdown
Contributor

@galt-tr galt-tr commented May 1, 2026

Summary

  • Store.SetMinedByTxIDs now takes blockHeight uint64; postgres / aerospike / pebble all persist the height alongside block_hash and echo it back on each returned TransactionStatus.
  • bump_builder.Builder threads blockHeight (lifted from the compound BUMP) into SetMinedByTxIDs and adds a defensive top-up on the publish path so a partial regression in any backend cannot reintroduce a zero-height MINED update.
  • Added three regression tests in services/bump_builder/builder_test.go (a recordingPublisher mock, an explicit non-trivial height case via transaction.NewMerklePath, a "height never zero" guard, and a "publish path repairs a buggy backend" test).

Closes #87 (F-029).

Where the height was being lost

services/bump_builder/builder.go captured blockHeight for InsertBUMP then called b.store.SetMinedByTxIDs(ctx, blockHash, txids) — no height. Every backend implementation of SetMinedByTxIDs therefore wrote only block_hash and built models.TransactionStatus with BlockHeight zero-valued, which the publisher then fanned out to SSE / webhook subscribers verbatim.

Test plan

  • go build ./...
  • go vet ./... (and go vet -tags=postgres ./..., -tags=integration, -tags=aerospike clean)
  • go test ./services/bump_builder/... ./store/... -count=1 -race
  • golangci-lint run ./services/bump_builder/... ./store/... — 0 issues
  • Reviewer to confirm downstream consumers benefit from the corrected height

…#87)

The mined-status update path was dropping blockHeight between
InsertBUMP and SetMinedByTxIDs (or the subsequent publish), so
downstream consumers received MINED statuses with a zero or unset
height. Block height is now threaded through the whole call chain
and asserted in tests. Closes F-029.
@galt-tr galt-tr requested a review from mrz1836 as a code owner May 1, 2026 19:33
@github-actions github-actions Bot added the size/L Large change (201–500 lines) label May 1, 2026
@github-actions github-actions Bot added the bug-P3 Lowest rated bug, affects nearly none or low-impact label May 1, 2026
galt-tr and others added 2 commits May 1, 2026 15:38
PR #121 (issue #91) added TestHandleCallback_UnknownTxid_NoPhantomRow
without the bearer header that PR #112 (issue #76) made mandatory on
the callback endpoint, so the test was failing on every PR rebased
onto main. Use the existing authedCallbackRequest helper.
Copy link
Copy Markdown
Collaborator

@mrz1836 mrz1836 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mrz1836 mrz1836 merged commit c112774 into main May 2, 2026
48 checks passed
@mrz1836 mrz1836 deleted the fix/issue-87-mined-status-block-height branch May 2, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-P3 Lowest rated bug, affects nearly none or low-impact size/L Large change (201–500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[F-029] mined status updates drop the block height before publishing

2 participants