• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Chia-Network / chia-blockchain / 23662694873

27 Mar 2026 06:58PM UTC coverage: 91.163% (-0.08%) from 91.246%
23662694873

push

github

web-flow
Fix combine_coins ignoring --max-coin-amount and including spent coins (#20717)

* Fix combine_coins ignoring max_coin_amount and including spent coins

The `combine_coins` method in `wallet_state_manager.py` had two bugs in
its `get_coin_records()` calls:

1. The `--max-coin-amount` / `-l` CLI flag was silently ignored when
   `--target-amount` was not provided. The fill-up query at line ~3026
   did not pass `amount_range`, so `coin_selection_config` limits had
   no effect.

2. Neither `get_coin_records()` call passed `spent_range`, so both
   returned spent coins alongside unspent ones. This caused combine to
   build invalid transactions referencing already-spent coins, which
   could never confirm and left the wallet stuck at 0 spendable.

Fix: add `spent_range=UInt32Range(stop=uint32(0))` to both call sites
and `amount_range` (from `coin_selection_config`) to the fill-up query.
This matches the pattern already used by `auto_claim_coins()`.

* Add test for combine_coins spent-coin rejection and fill-up filtering

Addresses review feedback: the new ValueError for already-spent
target_coin_ids had no test coverage, and the spent_range filter on the
fill-up get_coin_records query was not exercised with spent records
present.

test_combine_coins_rejects_spent_coins covers both paths:
1. Explicitly specifying a spent coin ID raises ValueError.
2. A fill-up combine (no explicit IDs, smallest-first) with spent
   records in the DB correctly skips them and selects only unspent coins.

10449 of 11633 branches covered (89.82%)

Branch coverage included in aggregate %.

46 of 46 new or added lines in 2 files covered. (100.0%)

109 existing lines in 26 files now uncovered.

106098 of 116212 relevant lines covered (91.3%)

1.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.89
/chia/full_node/full_node_api.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc