Fabian Jahr
231fc7b035
refactor: Introduce GetFirstStoredBlock helper function
2022-04-25 23:18:01 +02:00
Carl Dong
f0a2fb3c5d
scripted-diff: Rename pindexBestHeader, fHavePruned
...
...to m_best_header and m_have_pruned
-BEGIN VERIFY SCRIPT-
find_regex="\bpindexBestHeader\b" \
&& git grep -l -E "$find_regex" -- src \
| xargs sed -i -E "s@$find_regex@m_best_header@g"
find_regex="\bfHavePruned\b" \
&& git grep -l -E "$find_regex" -- src \
| xargs sed -i -E "s@$find_regex@m_have_pruned@g"
-END VERIFY SCRIPT-
2022-04-19 14:36:18 -04:00
Carl Dong
3308ecd3fc
move-mostly: Make fHavePruned a BlockMan member
...
[META] In the next commit, we move the clearing of fHavePruned to
BlockManager::Unload()
2022-04-19 14:34:56 -04:00
Carl Dong
0d567daf23
move-mostly: Make pindexBestHeader a ChainMan member
...
[META] In the next commit, we move the clearing of pindexBestHeader to
ChainstateManager::Unload()
2022-04-19 14:34:55 -04:00
MarcoFalke
fa1970f075
Make BlockManager::LoadBlockIndex private
2022-04-19 11:32:49 +02:00
Carl Dong
f865cf8ded
Add and use BlockManager::GetAllBlockIndices
2022-03-15 19:42:43 -04:00
Carl Dong
28ba0313ea
Add and use CBlockIndexHeightOnlyComparator
...
...also use std::sort for clarity
2022-03-15 19:42:43 -04:00
Carl Dong
c600ee3816
Only load BlockMan in BlockMan member functions
...
This commit effectively splits the "load block index itself" logic from
"derive Chainstate variables from loaded block index" logic.
This means that BlockManager::LoadBlockIndex{,DB} will only load what's
relevant to the BlockManager.
I strongly recommend reviewing with the following git-diff flags:
--color-moved=dimmed_zebra --color-moved-ws=allow-indentation-change
2022-03-15 19:42:41 -04:00
Anthony Towns
5be9ee3c54
refactor: more const annotations for uses of CBlockIndex*
2022-03-09 14:32:47 -05:00
Carl Dong
c2a1655799
style-only: Use using instead of typedef for BlockMap
2022-02-22 11:56:49 -05:00
Carl Dong
bec86ae326
blockstorage: Make m_block_index own CBlockIndex's
...
Instead of having CBlockIndex's live on the heap, which requires manual
memory management, have them be owned by m_block_index. This means that
they will live and die with BlockManager.
A change to BlockManager::LookupBlockIndex:
- Previously, it was a const member function returning a non-const CBlockIndex*
- Now, there's are const and non-const versions of
BlockManager::LookupBlockIndex returning a CBlockIndex with the same
const-ness as the member function:
(e.g. const CBlockIndex* LookupBlockIndex(...) const)
See next commit for some weirdness that this eliminates.
The range based for-loops are modernize (using auto + destructuring) in
a future commit.
2022-02-22 11:52:19 -05:00
Hennadii Stepanov
5d59ae0ba8
Remove/inline ReadRawBlockFromDisk(block_data, pindex, message_start)
2022-01-25 20:43:37 +01:00
Jon Atack
eaeeb88768
Require IsBlockPruned() to hold mutex cs_main
...
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-01-25 20:43:34 +01:00
Jon Atack
2e557ced28
Require WriteUndoDataForBlock() to hold mutex cs_main
...
Mutex cs_main is already held by the caller of WriteUndoDataForBlock().
This change is needed to require CBlockIndex::GetUndoPos() to hold
cs_main and CBlockIndex::nStatus to be guarded by cs_main in the
following commits without adding 2 unnecessary cs_main locks to
WriteUndoDataForBlock().
2022-01-25 20:43:19 +01:00
Russell Yanofsky
90fc8b089d
Add src/node/* code to node:: namespace
2022-01-06 22:14:16 -05:00
MarcoFalke
fa68a6c2fc
scripted-diff: Rename touched member variables
...
-BEGIN VERIFY SCRIPT-
ren() { sed -i "s/\<$1\>/$2/g" $( git grep -l "$1" ./src/ ) ; }
ren vinfoBlockFile m_blockfile_info
ren nLastBlockFile m_last_blockfile
ren fCheckForPruning m_check_for_pruning
ren setDirtyBlockIndex m_dirty_blockindex
ren setDirtyFileInfo m_dirty_fileinfo
-END VERIFY SCRIPT-
2022-01-05 16:19:11 +01:00
MarcoFalke
facd3df21f
Make blockstorage globals private members of BlockManager
2022-01-05 16:18:50 +01:00
MarcoFalke
faa8c2d7d7
doc: Clarify nPruneAfterHeight for signet
2022-01-05 16:17:22 +01:00
MarcoFalke
fa467f3913
move-only: Create WriteBlockIndexDB helper
...
Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2022-01-05 15:08:06 +01:00
MarcoFalke
fa88cfd3f9
Move functions to BlockManager
...
Needed for a later commit
2022-01-05 15:07:28 +01:00
MarcoFalke
fa7efc915b
Fixup style of moved code
...
Can be reviewed with --word-diff-regex=. -U0 --ignore-all-space
2022-01-02 17:05:22 +01:00
MarcoFalke
fade2a44f4
Move BlockManager to node/blockstorage
...
Can be reviewed with --color-moved=dimmed-zebra
2022-01-02 17:05:14 +01:00
MarcoFalke
fa2d21fec8
add missing atomic include
2021-06-22 11:06:30 +02:00
MarcoFalke
fa09a9eac8
style: Add { } to multi-line if
...
Can be reviewed with --word-diff-regex=. --ignore-all-space
2021-04-27 10:36:41 +02:00
MarcoFalke
fadafab833
move-only: Move functions to blockstorage
2021-04-27 10:36:23 +02:00
MarcoFalke
fa7e64d586
move-only: Move constants to blockstorage
2021-04-27 10:32:54 +02:00
MarcoFalke
fa81c30c6f
refactor: Move pruning/reindex/importing globals to blockstorage
...
Can be reviewed with --color-moved=dimmed-zebra
2021-04-27 10:32:24 +02:00
MarcoFalke
fa0c7d9ad2
move-only: Move *Disk functions to blockstorage
...
Can be reviewed with the git options
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2021-04-05 20:26:14 +02:00
MarcoFalke
fa413f07a1
move-only: Move ThreadImport to blockstorage
...
Can be reviewed with the git options
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2021-04-04 18:07:24 +02:00