Skip to content

storage: check alt blocks when handling missing tx request in DB#599

Open
redsh4de wants to merge 3 commits intoCuprate:mainfrom
redsh4de:feat/txs_in_block-alt-blocks
Open

storage: check alt blocks when handling missing tx request in DB#599
redsh4de wants to merge 3 commits intoCuprate:mainfrom
redsh4de:feat/txs_in_block-alt-blocks

Conversation

@redsh4de
Copy link
Copy Markdown
Contributor

@redsh4de redsh4de commented Apr 11, 2026

What

Support alt blocks in TxsInBlock

Closes #580

Why

txs_in_block only searches the main chain at the moment. A peer can request missing transactions for a block that is on an alt chain - either from a reorg or because Cuprate broadcasts alt blocks as of #577

Where

storage/blockchain

How

  • Rename existing get_alt_block to get_alt_block_information so it's more honest about it's return type (AltBlockInformation)
  • New get_alt_block mirrors the main-chain equivalent (returns Block, is used in txs_in_block)
  • Extend txs_in_block to try the main chain first, then fall back to alt-chain tables on KeyNotFound
  • add and use a alt_block_height helper to DRY

@github-actions github-actions Bot added the A-storage Area: Related to storage. label Apr 11, 2026
@redsh4de redsh4de force-pushed the feat/txs_in_block-alt-blocks branch 2 times, most recently from 979c85b to 0d94f7b Compare April 22, 2026 11:31
Comment thread storage/blockchain/src/ops/alt_block/block.rs Outdated
@redsh4de redsh4de force-pushed the feat/txs_in_block-alt-blocks branch from 0d94f7b to a96aa26 Compare May 2, 2026 16:23
@redsh4de
Copy link
Copy Markdown
Contributor Author

redsh4de commented May 2, 2026

this was made before the tapes db upgrade, aligned it just now

  • renamed the prior get_alt_block to get_alt_block_information so it's more honest about its return type (returns AltBlockInformation)
  • get_alt_block now is basically a mirror of get_block: also returns Block, and is used when looking up the missing txes

@redsh4de redsh4de force-pushed the feat/txs_in_block-alt-blocks branch from c052fa0 to 327ce1a Compare May 7, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-storage Area: Related to storage.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check alt blocks when handling missing tx request in DB

2 participants