Skip to content

Don't panic when block coinbase tx is nil#375

Merged
galt-tr merged 1 commit into
bsv-blockchain:release/wip-scale-2from
galt-tr:scalePanicFix2
Jan 9, 2026
Merged

Don't panic when block coinbase tx is nil#375
galt-tr merged 1 commit into
bsv-blockchain:release/wip-scale-2from
galt-tr:scalePanicFix2

Conversation

@galt-tr

@galt-tr galt-tr commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🤖 Claude Code Review

Status: Complete

This PR adds a nil check for block.CoinbaseTx before calling utxoDiff.ProcessTx() to prevent a panic when blocks loaded from seed files have no coinbase transaction.

Analysis:

The fix correctly addresses a legitimate edge case. In model/Block.go lines 288-291, NewBlockFromBytes sets CoinbaseTx to nil when the coinbase transaction is all zeros (empty), which occurs when blocks are loaded from seed files rather than being assembled normally.

The change is minimal and defensive - it adds a simple nil check alongside the existing utxoDiff != nil check before processing the coinbase transaction. This prevents a panic without affecting normal block processing.

No issues found.

@galt-tr galt-tr merged commit f3863c2 into bsv-blockchain:release/wip-scale-2 Jan 9, 2026
7 of 9 checks passed
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.

3 participants