Page MenuHomePhabricator

index: Add Coinstats index
ClosedPublic

Authored by PiRK on Jun 9 2022, 16:01.

Details

Reviewers
sdulfari
Group Reviewers
Restricted Project
Commits
rABC9239362cf12d: index: Add Coinstats index
Summary

Main commit
https://github.com/bitcoin/bitcoin/pull/19521/commits/dd58a4de21469d6d848ae309edc47f558628221d

index: Add Coinstats index

The index holds the values previously calculated in coinstats.cpp for each block, representing the state of the UTXO set at each height.


https://github.com/bitcoin/bitcoin/pull/19521/commits/57a026c30fef3138bb8db46e6865acb9dc2674f8

test: Add unit test for Coinstats index


https://github.com/bitcoin/bitcoin/pull/22047/commits/8ea8c927ac05980d6a81252e40b7444e9abb74f9

index: Avoid unnecessary type casts in coinstatsindex


Replace two database writes with a single atomic batch write, to avoid a risk of database corruption. See the corresponding review.

https://github.com/bitcoin/bitcoin/pull/22047/commits/1e3842385b8c0d15086c7cd8736f8c67e6c0c285

index: Use batch writing in coinstatsindex WriteBlock


This is a backport of core#19521 [4 & 8/17] and core#22047 [1 & 3/3]

Depends on D11597

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Jun 9 2022, 16:01

Tail of the build log:

wallet_abandonconflict.py                              | ✓ Passed  | 14 s
wallet_address_types.py                                | ✓ Passed  | 12 s
wallet_address_types.py --descriptors                  | ✓ Passed  | 8 s
wallet_avoidreuse.py                                   | ✓ Passed  | 4 s
wallet_avoidreuse.py --descriptors                     | ✓ Passed  | 4 s
wallet_backup.py                                       | ✓ Passed  | 22 s
wallet_balance.py                                      | ✓ Passed  | 24 s
wallet_balance.py --descriptors                        | ✓ Passed  | 11 s
wallet_basic.py                                        | ✓ Passed  | 19 s
wallet_coinbase_category.py                            | ✓ Passed  | 1 s
wallet_create_tx.py                                    | ✓ Passed  | 6 s
wallet_createwallet.py                                 | ✓ Passed  | 2 s
wallet_createwallet.py --descriptors                   | ✓ Passed  | 2 s
wallet_createwallet.py --usecli                        | ✓ Passed  | 3 s
wallet_descriptor.py                                   | ✓ Passed  | 6 s
wallet_disable.py                                      | ✓ Passed  | 0 s
wallet_dump.py                                         | ✓ Passed  | 4 s
wallet_encryption.py                                   | ✓ Passed  | 5 s
wallet_encryption.py --descriptors                     | ✓ Passed  | 5 s
wallet_hd.py                                           | ✓ Passed  | 6 s
wallet_hd.py --descriptors                             | ✓ Passed  | 5 s
wallet_import_rescan.py                                | ✓ Passed  | 5 s
wallet_import_with_label.py                            | ✓ Passed  | 1 s
wallet_importdescriptors.py                            | ✓ Passed  | 6 s
wallet_importmulti.py                                  | ✓ Passed  | 3 s
wallet_importprunedfunds.py                            | ✓ Passed  | 2 s
wallet_importprunedfunds.py --descriptors              | ✓ Passed  | 2 s
wallet_keypool.py                                      | ✓ Passed  | 3 s
wallet_keypool_topup.py                                | ✓ Passed  | 2 s
wallet_keypool_topup.py --descriptors                  | ✓ Passed  | 3 s
wallet_labels.py                                       | ✓ Passed  | 1 s
wallet_labels.py --descriptors                         | ✓ Passed  | 1 s
wallet_listreceivedby.py                               | ✓ Passed  | 9 s
wallet_listsinceblock.py                               | ✓ Passed  | 5 s
wallet_listsinceblock.py --descriptors                 | ✓ Passed  | 6 s
wallet_listtransactions.py                             | ✓ Passed  | 4 s
wallet_listtransactions.py --descriptors               | ✓ Passed  | 3 s
wallet_multiwallet.py                                  | ✓ Passed  | 39 s
wallet_multiwallet.py --usecli                         | ✓ Passed  | 10 s
wallet_reorgsrestore.py                                | ✓ Passed  | 3 s
wallet_resendwallettransactions.py                     | ✓ Passed  | 3 s
wallet_send.py                                         | ✓ Passed  | 6 s
wallet_startup.py                                      | ✓ Passed  | 2 s
wallet_txn_clone.py                                    | ✓ Passed  | 2 s
wallet_txn_clone.py --mineblock                        | ✓ Passed  | 3 s
wallet_txn_doublespend.py                              | ✓ Passed  | 2 s
wallet_txn_doublespend.py --mineblock                  | ✓ Passed  | 3 s
wallet_watchonly.py                                    | ✓ Passed  | 1 s
wallet_watchonly.py --usecli                           | ✓ Passed  | 1 s

ALL                                                    | ✓ Passed  | 1179 s (accumulated) 
Runtime: 244 s

----------------------------------------------------------------------
Ran 10 tests in 0.093s

OK

ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1
PiRK planned changes to this revision.Jun 10 2022, 09:09
sdulfari requested changes to this revision.Jun 10 2022, 17:21
sdulfari added a subscriber: sdulfari.

This diff is quite large. Please include a short rationale for why each backported commit was squashed into this one patch. That will help reviewers be more confident that it is complete.

This revision now requires changes to proceed.Jun 10 2022, 17:21
PiRK requested review of this revision.Jun 11 2022, 12:07

I added comments and the commit messages for each commit to the summary.

The unit test commit and file can be reviewed independently.

The main file has a main commit, a commit with a minor code improvement (avoid an unneccessary cast) and a commit that fixes a potential race in a database write operation.

This revision is now accepted and ready to land.Jun 13 2022, 18:16
This revision was automatically updated to reflect the committed changes.