Skip to content

[UTXO-BUG] Support legacy balance schema during epoch reward settlement#8017

Open
Zephyr-Echo wants to merge 1 commit into
Scottcjn:mainfrom
Zephyr-Echo:codex/utxo-legacy-reward-schema
Open

[UTXO-BUG] Support legacy balance schema during epoch reward settlement#8017
Zephyr-Echo wants to merge 1 commit into
Scottcjn:mainfrom
Zephyr-Echo:codex/utxo-legacy-reward-schema

Conversation

@Zephyr-Echo

@Zephyr-Echo Zephyr-Echo commented Jul 19, 2026

Copy link
Copy Markdown

Summary

finalize_epoch() updated balances using miner_id/amount_i64 unconditionally.
Legacy databases created by init_db() use miner_pk/balance_rtc, so enabling
UTXO_DUAL_WRITE caused epoch settlement to roll back with:

sqlite3.OperationalError: no such column: amount_i64

Fix

Reuse the existing schema-tolerant balance helpers and add a regression test for
legacy balances with UTXO dual-write enabled. The patch preserves the existing
no-phantom invariant: miners without an account row are not credited or ledgered.

Validation

  • python -m pytest -q node/tests/test_integrated_balance_scale.py
  • python -m pytest -q node/test_utxo_db.py node/tests/test_epoch_utxo_dual_write_guard.py
  • python -m py_compile node/rustchain_v2_integrated_v2.2.1_rip200.py

wallet: RTC6340d6bd7fd0804ad8afb1f319f826acc784ed26

@Zephyr-Echo
Zephyr-Echo requested a review from Scottcjn as a code owner July 19, 2026 16:55
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related tests Test suite changes size/M PR: 51-200 lines labels Jul 19, 2026
@Zephyr-Echo

Copy link
Copy Markdown
Author

Thanks for reviewing. The change is limited to schema-compatible epoch reward
settlement and preserves the existing no-phantom balance invariant. No live
network testing was performed. I will keep payout details and private contact
information out of the public thread unless you request a private channel.

@Scottcjn

Copy link
Copy Markdown
Owner

@Zephyr-Echo Your work here was accepted and we owe you ~15 RTC (pending merge) — it slipped through because we never got a wallet from you. Drop your RustChain wallet address here (your GitHub handle also works as a wallet id) and I'll send it once this lands. Thank you for contributing. — Sophia, Elyan Labs

@Zephyr-Echo

Copy link
Copy Markdown
Author

Thank you. Please use my public GitHub handle Zephyr-Echo as the RustChain wallet ID for the ~15 RTC bounty once this PR is merged.

@Zephyr-Echo

Copy link
Copy Markdown
Author

Thanks, Sophia. I added the explicit wallet: directive to the PR body.

Please send the ~15 RTC bounty to:
RTC6340d6bd7fd0804ad8afb1f319f826acc784ed26

This is my native RustChain wallet, not a Coinbase/Base wallet. Please confirm the destination and share the transaction ID after PR #8017 merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related size/M PR: 51-200 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants