Skip to content

mining: Make extra pool persistent when rejecttokens=1#313

Open
pdath wants to merge 1 commit into
bitcoinknots:29.x-knotsfrom
pdath:feature-persist-extra-pool
Open

mining: Make extra pool persistent when rejecttokens=1#313
pdath wants to merge 1 commit into
bitcoinknots:29.x-knotsfrom
pdath:feature-persist-extra-pool

Conversation

@pdath

@pdath pdath commented Jun 14, 2026

Copy link
Copy Markdown

When rejecttokens=1 tokens are stored in the extra pool, rather than the mempool. When Bitcoin Knots is restarted, the extra pool is lost.

The issue this creates is that compact block reconstructions for tokens becomes very slow after a restart, because the extra pool is empty. The causes Bitcoin Knots to have to fetch thousands of transactions from peers. Examples are (with "debug=cmpctblock"):

2026-06-10T06:22:16.634294Z [cmpctblock] Successfully reconstructed block 00000000000000000000aa2798940f3de06a3b6b8bf845bb872a1322a8ce6688 with 1 txn prefilled, 2181 txn from mempool (incl at least 804 from extra pool) and 2297 txn requested 2026-06-10T06:47:45.132446Z [cmpctblock] Successfully reconstructed block 000000000000000000009b2bb14d59eb073cb3aa0a1a370236b5822b99663340 with 1 txn prefilled, 2847 txn from mempool (incl at least 435 from extra pool) and 959 txn requested 2026-06-10T06:55:41.588544Z [cmpctblock] Successfully reconstructed block 00000000000000000000a51c141257c439152ffb45c6a3bded318ffaef161b78 with 1 txn prefilled, 2523 txn from mempool (incl at least 521 from extra pool) and 1800 txn requested

To resolve this issue I propose treating the extra pool like the mempool, and saving/loading the state to extrapool.dat, but only when rejecttokens=1.

The issue does not happen when rejecttokens=0, because tokens then get stored in mempool.dat, and persisted across restarts.

When rejecttokens=1 tokens are stored in the extra pool, rather than the mempool.  When Bitcoin Knots is restarted, the extra pool is lost.

The issue this creates is that compact block reconstructions for tokens becomes very slow after a restart, because the extra pool is empty.  The causes Bitcoin Knots to have to fetch thousands of transactions from peers.  Examples are (with "debug=cmpctblock"):

2026-06-10T06:22:16.634294Z [cmpctblock] Successfully reconstructed block 00000000000000000000aa2798940f3de06a3b6b8bf845bb872a1322a8ce6688 with 1 txn prefilled, 2181 txn from mempool (incl at least 804 from extra pool) and 2297 txn requested
2026-06-10T06:47:45.132446Z [cmpctblock] Successfully reconstructed block 000000000000000000009b2bb14d59eb073cb3aa0a1a370236b5822b99663340 with 1 txn prefilled, 2847 txn from mempool (incl at least 435 from extra pool) and 959 txn requested
2026-06-10T06:55:41.588544Z [cmpctblock] Successfully reconstructed block 00000000000000000000a51c141257c439152ffb45c6a3bded318ffaef161b78 with 1 txn prefilled, 2523 txn from mempool (incl at least 521 from extra pool) and 1800 txn requested

To resolve this issue I propose treating the extra pool like the mempool, and saving/loading the state to extrapool.dat, but only when rejecttokens=1.

The issue does not happen when rejecttokens=0, because tokens then get stored in mempool.dat, and persisted across restarts.
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