Page MenuHomePhabricator

Store the last 20 headers reception time to a file
ClosedPublic

Authored by Fabien on Sep 19 2024, 23:41.

Details

Reviewers
roqqit
PiRK
Group Reviewers
Restricted Project
Commits
rABCcec261f248b8: Store the last 20 headers reception time to a file
Summary

And load it at startup. This is bootstrapping the RTT algorithm so the difficulty might only be over-estimated after a restart and miners won't mine rejected blocks.

This is opt-in because most nodes simply don't need the feature, it's an optimization that only impacts the miners.

Test Plan
ninja all check-all

Diff Detail

Event Timeline

Fabien requested review of this revision.Sep 19 2024, 23:41

Tail of the build log:

wallet_startup.py                          | ✓ Passed  | 6 s
wallet_timelock.py                         | ✓ Passed  | 2 s
wallet_txn_clone.py                        | ✓ Passed  | 4 s
wallet_txn_clone.py --mineblock            | ✓ Passed  | 5 s
wallet_txn_doublespend.py                  | ✓ Passed  | 4 s
wallet_txn_doublespend.py --mineblock      | ✓ Passed  | 5 s
wallet_watchonly.py                        | ✓ Passed  | 3 s
wallet_watchonly.py --usecli               | ✓ Passed  | 4 s
chronik_avalanche.py                       | ○ Skipped | 0 s
chronik_block.py                           | ○ Skipped | 0 s
chronik_block_header.py                    | ○ Skipped | 0 s
chronik_block_info.py                      | ○ Skipped | 0 s
chronik_block_txs.py                       | ○ Skipped | 0 s
chronik_blockchain_info.py                 | ○ Skipped | 0 s
chronik_blocks.py                          | ○ Skipped | 0 s
chronik_chronik_info.py                    | ○ Skipped | 0 s
chronik_cors.py                            | ○ Skipped | 0 s
chronik_disable_token_index.py             | ○ Skipped | 0 s
chronik_disallow_prune.py                  | ○ Skipped | 0 s
chronik_lokad_id_group.py                  | ○ Skipped | 0 s
chronik_mempool_conflicts.py               | ○ Skipped | 0 s
chronik_mempool_disconnectpool.py          | ○ Skipped | 0 s
chronik_pause.py                           | ○ Skipped | 0 s
chronik_plugin_groups.py                   | ○ Skipped | 0 s
chronik_plugins.py                         | ○ Skipped | 0 s
chronik_plugins_setup.py                   | ○ Skipped | 0 s
chronik_raw_tx.py                          | ○ Skipped | 0 s
chronik_resync.py                          | ○ Skipped | 0 s
chronik_script_confirmed_txs.py            | ○ Skipped | 0 s
chronik_script_history.py                  | ○ Skipped | 0 s
chronik_script_unconfirmed_txs.py          | ○ Skipped | 0 s
chronik_script_utxos.py                    | ○ Skipped | 0 s
chronik_serve.py                           | ○ Skipped | 0 s
chronik_spent_by.py                        | ○ Skipped | 0 s
chronik_token_alp.py                       | ○ Skipped | 0 s
chronik_token_broadcast_txs.py             | ○ Skipped | 0 s
chronik_token_burn.py                      | ○ Skipped | 0 s
chronik_token_id_group.py                  | ○ Skipped | 0 s
chronik_token_parse_failure.py             | ○ Skipped | 0 s
chronik_token_script_group.py              | ○ Skipped | 0 s
chronik_token_slp_fungible.py              | ○ Skipped | 0 s
chronik_token_slp_mint_vault.py            | ○ Skipped | 0 s
chronik_token_slp_nft1.py                  | ○ Skipped | 0 s
chronik_tx.py                              | ○ Skipped | 0 s
chronik_tx_removal_order.py                | ○ Skipped | 0 s
chronik_ws.py                              | ○ Skipped | 0 s
chronik_ws_ordering.py                     | ○ Skipped | 0 s
chronik_ws_ping.py                         | ○ Skipped | 0 s
chronik_ws_script.py                       | ○ Skipped | 0 s
feature_bind_port_discover.py              | ○ Skipped | 0 s
feature_bind_port_externalip.py            | ○ Skipped | 0 s
interface_usdt_net.py                      | ○ Skipped | 0 s
interface_usdt_utxocache.py                | ○ Skipped | 0 s
interface_usdt_validation.py               | ○ Skipped | 0 s

ALL                                        | ✓ Passed  | 2298 s (accumulated) 
Runtime: 465 s

ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1
roqqit added a subscriber: roqqit.
roqqit added inline comments.
src/node/chainstatemanager_args.cpp
21

linter doesn't catch this?

src/test/validation_chainstatemanager_tests.cpp
760
This revision is now accepted and ready to land.Sep 20 2024, 00:37
roqqit requested changes to this revision.Sep 20 2024, 00:38

The patch looks ok but there is a test failure

This revision now requires changes to proceed.Sep 20 2024, 00:38

Improve logging + feedback

I can't reproduce the test failure locally, the load function is failing in the test.
I'll need to improve the reporting a bit to investigate, this diff will be rebased to do so.

src/node/chainstatemanager_args.cpp
21

Apparently it doesn't

Rebase on top of D16794, hopefully to test will fail

Fabien planned changes to this revision.Sep 20 2024, 20:22

The option should not be hidden

Document -persistrecentheaderstime

PiRK added a subscriber: PiRK.
PiRK added inline comments.
src/test/validation_chainstatemanager_tests.cpp
800 ↗(On Diff #49766)
This revision is now accepted and ready to land.Sep 23 2024, 16:15