Skip to content

Fix funding stream address rotation panic at ~35,000 blocks - #25

Open
hyphae-bot wants to merge 1 commit into
ShieldedLabs:mainfrom
hyphae-bot:fix/funding-stream-address-rotation
Open

Fix funding stream address rotation panic at ~35,000 blocks#25
hyphae-bot wants to merge 1 commit into
ShieldedLabs:mainfrom
hyphae-bot:fix/funding-stream-address-rotation

Conversation

@hyphae-bot

Copy link
Copy Markdown

Problem

All cTAZ testnet nodes crash at approximately block 35,000 with:

panicked at zebra-consensus/src/block/subsidy/funding_streams.rs:39:5:
assertion failed: index > 0 && index <= num_addresses

The crash occurs in get_block_templatestandard_coinbase_outputsfunding_stream_address, affecting both the internal miner and any external getblocktemplate RPC calls.

Root Cause

The funding stream address rotation formula (funding_streams.rs:30-38) computes:

index = 1 + address_period(height) - address_period(start_height)

where address_period changes every ~35,000 blocks (POST_BLOSSOM_HALVING_INTERVAL / 48).

The Crosslink config in application.rs provides only 1 address for the funding stream (height range 1..99,999,999). Once the chain advances past the first address period boundary, the computed index exceeds the number of available addresses, triggering the assertion panic.

Fix

Replace the strict assertion with a modulo wrap:

// Before:
assert!(index > 0 && index <= num_addresses);
Some(index - 1)

// After:
assert!(index > 0);
Some((index - 1) % num_addresses)

This cycles through available addresses instead of panicking when the period boundary is crossed.

Testing

Built from s1v4 source with this patch applied. Node successfully syncs and mines past block 35,000 on cTAZ testnet.

Alternative Approaches

For a more permanent solution, consider:

  • Adding sufficient addresses to cover the full funding stream range (~2,858 for 1..99,999,999)
  • Setting should_lock_funding_stream_address_period = true to always use index 0

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.

1 participant