Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864753
D13320.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D13320.id.diff
View Options
diff --git a/chronik/chronik-indexer/src/indexer.rs b/chronik/chronik-indexer/src/indexer.rs
--- a/chronik/chronik-indexer/src/indexer.rs
+++ b/chronik/chronik-indexer/src/indexer.rs
@@ -48,7 +48,8 @@
/// Cannot rewind blocks that bitcoind doesn't have
#[error(
"Cannot rewind Chronik, it contains block {0} that the node doesn't \
- have. You may need to -reindex, or delete indexes/chronik and restart"
+ have. You may need to use -reindex/-chronikreindex, or delete \
+ indexes/chronik and restart"
)]
CannotRewindChronik(BlockHash),
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -642,6 +642,10 @@
regtestBaseParams->ChronikPort()),
ArgsManager::ALLOW_STRING | ArgsManager::NETWORK_ONLY,
OptionsCategory::CHRONIK);
+ argsman.AddArg("-chronikreindex",
+ "Reindex the Chronik indexer from genesis, but leave the "
+ "other indexes untouched",
+ ArgsManager::ALLOW_BOOL, OptionsCategory::CHRONIK);
#endif
argsman.AddArg(
"-blockfilterindex=<type>",
@@ -2651,7 +2655,9 @@
#if ENABLE_CHRONIK
if (args.GetBoolArg("-chronik", chronik::DEFAULT_ENABLED)) {
- if (!chronik::Start(config, node, fReindex)) {
+ const bool fReindexChronik =
+ fReindex || args.GetBoolArg("-chronikreindex", false);
+ if (!chronik::Start(config, node, fReindexChronik)) {
return false;
}
}
diff --git a/test/functional/chronik_resync.py b/test/functional/chronik_resync.py
--- a/test/functional/chronik_resync.py
+++ b/test/functional/chronik_resync.py
@@ -98,8 +98,8 @@
# It needs the node's block data to undo the stale blocks.
init_error_msg = (
f"Error: Cannot rewind Chronik, it contains block {block_hashes[149]} " +
- "that the node doesn't have. You may need to -reindex, or delete " +
- "indexes/chronik and restart"
+ "that the node doesn't have. You may need to use -reindex/" +
+ "-chronikreindex, or delete indexes/chronik and restart"
)
node.assert_start_raises_init_error(["-chronik"], init_error_msg)
@@ -124,6 +124,13 @@
self.restart_node(0, ['-chronik', '-reindex'])
assert_equal(query_block(100).status, 200)
+ # Test -chronikreindex
+ with node.assert_debug_log(["Wiping Chronik at "]):
+ self.restart_node(0, ['-chronik', '-chronikreindex'])
+ assert_equal(query_block(0).status, 200)
+ assert_equal(query_block(100).status, 200)
+ assert_equal(query_block(101).status, 404)
+
if __name__ == '__main__':
ChronikResyncTest().main()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 22:11 (20 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5861740
Default Alt Text
D13320.id.diff (2 KB)
Attached To
D13320: [Chronik] Add `-chronikreindex` to only reindex Chronik
Event Timeline
Log In to Comment