Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864581
D18113.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
D18113.diff
View Options
diff --git a/chronik/chronik-cpp/chronik.cpp b/chronik/chronik-cpp/chronik.cpp
--- a/chronik/chronik-cpp/chronik.cpp
+++ b/chronik/chronik-cpp/chronik.cpp
@@ -61,14 +61,15 @@
const auto electrum_hosts = args.GetArgs("-chronikelectrumbind");
const bool is_scripthashindex_enabled =
- args.GetBoolArg("-chronikscripthashindex", false);
+ args.GetBoolArg("-chronikscripthashindex", !electrum_hosts.empty());
if (!electrum_hosts.empty()) {
if (args.IsArgSet("-chronikelectrumcert") ^
args.IsArgSet("-chronikelectrumprivkey")) {
return {{_("The -chronikelectrumcert and -chronikelectrumprivkey "
"options should both be set or unset.")}};
}
- if (!is_scripthashindex_enabled) {
+ if (args.IsArgSet("-chronikscripthashindex") &&
+ !is_scripthashindex_enabled) {
return {{_("The -chronikelectrumbind option requires "
"-chronikscripthashindex to be true.")}};
}
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -713,10 +713,10 @@
"Output some performance statistics (e.g. num cache hits, "
"seconds spent) into a <datadir>/perf folder. (default: 0)",
ArgsManager::ALLOW_BOOL, OptionsCategory::CHRONIK);
- argsman.AddArg(
- "-chronikscripthashindex",
- "Enable the scripthash index for the Chronik indexer (default: 0) ",
- ArgsManager::ALLOW_BOOL, OptionsCategory::CHRONIK);
+ argsman.AddArg("-chronikscripthashindex",
+ "Enable the scripthash index for the Chronik indexer "
+ "(default: 1 if chronikelectrumbind is set, 0 otherwise) ",
+ ArgsManager::ALLOW_BOOL, OptionsCategory::CHRONIK);
argsman.AddArg(
"-chronikelectrumbind=<addr>[:port][:t|s]",
strprintf(
diff --git a/test/functional/chronik_electrum_basic.py b/test/functional/chronik_electrum_basic.py
--- a/test/functional/chronik_electrum_basic.py
+++ b/test/functional/chronik_electrum_basic.py
@@ -20,7 +20,6 @@
[
"-chronik",
f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}:t",
- "-chronikscripthashindex=1",
]
]
@@ -126,10 +125,6 @@
def test_init_errors(self):
self.node.stop_node()
- self.node.assert_start_raises_init_error(
- ["-chronik", f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}:t"],
- "Error: The -chronikelectrumbind option requires -chronikscripthashindex to be true.",
- )
self.node.assert_start_raises_init_error(
[
"-chronik",
@@ -143,7 +138,6 @@
self.node.assert_start_raises_init_error(
[
"-chronik",
- "-chronikscripthashindex=1",
f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
],
"Error: Chronik Electrum TLS configuration requires a certificate chain file (see -chronikelectrumcert)",
@@ -152,7 +146,6 @@
self.node.assert_start_raises_init_error(
[
"-chronik",
- "-chronikscripthashindex=1",
f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}:s",
],
"Error: Chronik Electrum TLS configuration requires a certificate chain file (see -chronikelectrumcert)",
@@ -160,7 +153,6 @@
self.node.assert_start_raises_init_error(
[
"-chronik",
- "-chronikscripthashindex=1",
"-chronikelectrumcert=dummy",
f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
],
@@ -169,7 +161,6 @@
self.node.assert_start_raises_init_error(
[
"-chronik",
- "-chronikscripthashindex=1",
"-chronikelectrumprivkey=dummy",
f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
],
@@ -178,7 +169,6 @@
self.node.assert_start_raises_init_error(
[
"-chronik",
- "-chronikscripthashindex=1",
"-chronikelectrumcert=dummy",
"-chronikelectrumprivkey=dummy",
f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
diff --git a/test/functional/chronik_electrum_blockchain.py b/test/functional/chronik_electrum_blockchain.py
--- a/test/functional/chronik_electrum_blockchain.py
+++ b/test/functional/chronik_electrum_blockchain.py
@@ -52,7 +52,6 @@
[
"-chronik",
f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}:t",
- "-chronikscripthashindex=1",
]
]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 20:39 (9 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865903
Default Alt Text
D18113.diff (4 KB)
Attached To
D18113: [chronik] Electrum: implicitely enable the scripthashindex if the electrum interface is used
Event Timeline
Log In to Comment