Skip to content

Conversation

@AlanRuno
Copy link
Owner

Summary

Fixes a bug where genesis block creation was adding coinbase transactions to the block but not creating the corresponding UTXOs in the UTXO database. This meant validators had no spendable balance after genesis, even though the block showed the correct total_supply.

The fix adds a call to mxd_create_utxos_from_tx() immediately after creating each coinbase transaction during genesis coordination.

Review & Testing Checklist for Human

  • Verify UTXO database initialization timing: Confirm that the UTXO database (RocksDB) is initialized before mxd_try_coordinate_genesis_block() runs, otherwise mxd_create_utxos_from_tx() will fail silently
  • Test in multi-node environment: Deploy a fresh 10-node test network with -reset flag and verify that validators actually have 100 MXD spendable balance (check via UTXO lookup, not just metrics display)
  • Review error handling: Currently total_minted is incremented even when UTXO creation fails (line 2311-2312). Consider whether this could cause inconsistency between reported total_supply and actual spendable UTXOs

Recommended test plan:

  1. Run ./mxd_test_suite test --project mxd-network --nodes 10 --skip-destroy
  2. SSH into a node and check UTXO balance for a validator address
  3. Attempt to create and submit a transaction from one validator to another
  4. Verify the transaction is included in a subsequent block

Notes

  • This bug was discovered during 10-node test network deployment where the rapid stake table showed 0.00 stake for all validators despite the metrics display showing "Stake: 100.00 MXD" (which came from config defaults, not actual UTXOs)
  • The fix was not tested on a live network as the test VMs were shut down before the fix was implemented

Link to Devin run: https://app.devin.ai/sessions/dddc2bc4662d4c4a9bc984532b259c36
Requested by: Runo (@AlanRuno)

…ation

The genesis block creation was adding coinbase transactions to the block but
not creating the corresponding UTXOs in the UTXO database. This meant that
validators had no spendable balance after genesis, even though the block
showed the correct total_supply.

This fix adds a call to mxd_create_utxos_from_tx() immediately after creating
each coinbase transaction, ensuring that validators have actual spendable
UTXOs after genesis block creation.
@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@AlanRuno AlanRuno merged commit f32f090 into main Jan 20, 2026
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.

2 participants