Skip to content

45 Day Maturity Softfork - Permanent - #480

Open
FlyTheElephant1 wants to merge 1 commit into
bitcoinknots:29.x-knotsfrom
FlyTheElephant1:permanent-6480-maturity
Open

FlyTheElephant1 wants to merge 1 commit into
bitcoinknots:29.x-knotsfrom
FlyTheElephant1:permanent-6480-maturity

Conversation

@FlyTheElephant1

@FlyTheElephant1 FlyTheElephant1 commented Oct 23, 2026 •

Copy link
Copy Markdown

Motivation

The temporary 6480-block coinbase maturity window (heights 973440–979919) currently ends at 979920 and releases every coin in that window at once. This change makes the 6480 maturity permanent by setting CoinbaseMaturityLongReleaseHeight to INT_MAX and CoinbaseMaturityLong to 6480. Coins created at or after 973440 mature in 6480 blocks.

The revalidation marker is extended to the same permanent range so nodes that previously certified the temporary window re-check from the start height onward.

Tests

src/test/coinbase_maturity_tests.cpp updated so mainnet asserts the permanent 6480 + max release height while testnet4 and regtest keep their original temporary-window checks.
./build/bin/test_bitcoin --run_test=coinbase_maturity_tests reports no errors.

@geobees

geobees commented Oct 24, 2026

Copy link
Copy Markdown

Tested 235347e (Ubuntu on WSL2, GCC 15.2.0, no GUI). Not an ACK yet, one unit test regression:

Fails: validation_chainstatemanager_tests/chainstatemanager_snapshot_revalidation_waits_for_background
validation_chainstatemanager_tests.cpp(703): check marker.stop_height == 102 has failed [103 != 102]

The same test passes on the base (58398ba, 10 test cases, no errors), so this comes from the PR. Cause: the shared helper AddLongCoinbaseMaturityRevalidationDeployment changed stop_height from ReleaseHeight - 1 to ReleaseHeight, which moves the regtest revalidation range by one block. coinbase_maturity_tests was updated for it (149 -> 150) but this test was not. The mainnet change doesn't need that edit, since INT_MAX - 1 is already a valid stop height.

Verified locally: reverting the stop_height line in chainparams.cpp to ReleaseHeight - 1 makes validation_chainstatemanager_tests pass again; coinbase_maturity_tests then only needs its three stop_height expectations reverted (mainnet INT_MAX - 1, testnet4 158110, regtest 149).

Passes: build; coinbase_maturity_tests; unit suite 145/146 (only the failure above); functional: feature_chainstate_revalidation, mempool_long_coinbase_maturity, mempool_spend_coinbase.

Nit: with the release height at INT_MAX, rpc/blockchain.cpp (~line 1967) returns early, so the long-maturity window info (height_end, maturity) appears to stop being reported on mainnet. Tools reading it will no longer see it.

Happy to re-test once the test is fixed.

@FlyTheElephant1
FlyTheElephant1 force-pushed the permanent-6480-maturity branch from 235347e to 98f8ea8 Compare October 24, 2026 03:33
@geobees

geobees commented Oct 24, 2026

Copy link
Copy Markdown

Re-tested 98f8ea8: the chainparams revert fixes validation_chainstatemanager_tests (passes now). One assertion left in coinbase_maturity_tests.cpp:48 (testnet4): test_deployment.stop_height == test_consensus.CoinbaseMaturityLongReleaseHeight fails [158110 != 158111]. It needs - 1 like the mainnet check above it.

@FlyTheElephant1
FlyTheElephant1 force-pushed the permanent-6480-maturity branch from 98f8ea8 to eb6e889 Compare October 24, 2026 03:51
@geobees

geobees commented Oct 24, 2026

Copy link
Copy Markdown

Re-tested eb6e889 (Ubuntu on WSL2, GCC 15.2.0, no GUI): the earlier failures are fixed.

  • build OK
  • coinbase_maturity_tests: pass
  • validation_chainstatemanager_tests: pass
  • unit suite: 146/146
  • functional: feature_chainstate_revalidation, mempool_long_coinbase_maturity, mempool_spend_coinbase pass

Only nit left: with ReleaseHeight at INT_MAX, rpc/blockchain.cpp (~line 1967) returns early, so height_end / maturity appear to stop being reported on mainnet.

@FlyTheElephant1
FlyTheElephant1 force-pushed the permanent-6480-maturity branch from eb6e889 to c705c3a Compare October 24, 2026 04:04
@geobees

geobees commented Oct 24, 2026

Copy link
Copy Markdown

Tested c705c3a on top of 58398ba.

  • Build OK, ctest 146/146
  • coinbase_maturity_tests, feature_chainstate_revalidation, mempool_long_coinbase_maturity, mempool_spend_coinbase: pass
  • rpc_blockchain.py (v1 and v2 transport): FAIL. eb6e889 passes.

Dropping the early return in LongCoinbaseMaturityDescPushBack makes networks that never configure the deployment (e.g. regtest) report:
long_coinbase_maturity {height: 2147483647, coinbase_start_height: 2147483647, maturity: 100, active: false}
but _test_getdeploymentinfo expects deployments: {}.

Adding this line at the top of the function makes rpc_blockchain.py pass on both transports:
if (params.CoinbaseMaturityLongEnforceHeight == std::numeric_limits::max()) return;
Mainnet still reports the entry, and the height_end guard stays as is. I did not re-run the full suite with that line.

@FlyTheElephant1
FlyTheElephant1 force-pushed the permanent-6480-maturity branch from c705c3a to 4bd9f45 Compare October 24, 2026 04:46
@geobees

geobees commented Oct 24, 2026

Copy link
Copy Markdown

Tested 4bd9f45 on top of 58398ba.

As pushed it does not build: in LongCoinbaseMaturityDescPushBack the new guard
if (params.CoinbaseMaturityLongEnforceHeight == std::numeric_limits<int>::max()) return;
comes before const Consensus::Params& params{chainman.GetConsensus()};
-> src/rpc/blockchain.cpp:1966: error: 'params' was not declared in this scope

With those two lines swapped (declaration first, then the guard) I get:

  • build OK
  • ctest 146/146
  • rpc_blockchain.py (v1 and v2 transport), feature_chainstate_revalidation, mempool_long_coinbase_maturity, mempool_spend_coinbase: all pass

So the logic looks right...it just needs the lines reordered.

Remove the temporary window cliff by setting CoinbaseMaturityLongReleaseHeight
to INT_MAX and CoinbaseMaturityLong to 6480. Coins created at or after 973440
remain locked for 6480 blocks indefinitely instead of all releasing at 979920.

Extend the long_coinbase_maturity revalidation marker to the same permanent
range so nodes re-check from the start height onward. Keep the exclusive
stop_height style (ReleaseHeight - 1) so existing test assumptions continue
to hold. Show the permanent rule in getdeploymentinfo without a height_end.

Update unit tests for the new mainnet schedule while leaving testnet4 and
regtest temporary windows unchanged.
@FlyTheElephant1
FlyTheElephant1 force-pushed the permanent-6480-maturity branch from 4bd9f45 to b525aec Compare October 24, 2026 06:45
@geobees

geobees commented Oct 24, 2026

Copy link
Copy Markdown

Tested b525aec

Ubuntu on WSL2, GCC 15.2, no GUI, on top of 58398ba.

  • build OK
  • ctest 146/146 (incl. coinbase_maturity_tests, validation_chainstatemanager_tests)
  • functional: rpc_blockchain (v1+v2 transport), feature_chainstate_revalidation, mempool_long_coinbase_maturity, mempool_spend_coinbase: pass

Earlier heads had a validation_chainstatemanager_tests failure (stop_height), an rpc_blockchain failure on unconfigured networks (c705c3a) and a compile error (4bd9f45); all fixed here. I did not test combining with #468.

@FlyTheElephant1

Copy link
Copy Markdown
Author

./build/bin/test_bitcoin
Running 765 test cases...

*** No errors detected

I got the same result as you on the ctest.

Debian bookworm.

@geobees

geobees commented Oct 24, 2026

Copy link
Copy Markdown

Tested ACK b525aec (details above).

@chainboarder

chainboarder commented Oct 24, 2026 •

Copy link
Copy Markdown

Concept NACK

1 similar comment
@mynpub

mynpub commented Oct 24, 2026

Copy link
Copy Markdown

Concept NACK

@ghastlyxbt

Copy link
Copy Markdown

Concept NACK.

Too small CBM to be effective.

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.

5 participants