Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864910
D18112.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
D18112.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
@@ -124,7 +124,7 @@
},
.electrum_hosts = ToRustVec<rust::String>(electrum_hosts),
.electrum_default_port = BaseParams().ChronikElectrumPort(),
- .electrum_default_protocol = 't',
+ .electrum_default_protocol = 's',
.electrum_cert_path = args.GetArg("-chronikelectrumcert", ""),
.electrum_privkey_path = args.GetArg("-chronikelectrumprivkey", ""),
.electrum_max_history = static_cast<uint32_t>(electrum_max_history),
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -727,7 +727,7 @@
"'s' means TLS. If TLS is selected, the certificate chain and "
"private key must both be passed (see -chronikelectrumcert and "
"-chronikelectrumprivkey (default: disabled; default port: %u, "
- "testnet: %u, regtest: %u; default protocol: TCP)",
+ "testnet: %u, regtest: %u; default protocol: TLS)",
defaultBaseParams->ChronikElectrumPort(),
testnetBaseParams->ChronikElectrumPort(),
regtestBaseParams->ChronikElectrumPort()),
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
@@ -6,6 +6,7 @@
"""
from test_framework.address import ADDRESS_ECREG_UNSPENDABLE
from test_framework.test_framework import BitcoinTestFramework
+from test_framework.test_node import ErrorMatch
from test_framework.util import assert_equal, chronikelectrum_port, get_cli_version
ELECTRUM_PROTOCOL_VERSION = "1.4"
@@ -18,7 +19,7 @@
self.extra_args = [
[
"-chronik",
- f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
+ f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}:t",
"-chronikscripthashindex=1",
]
]
@@ -134,19 +135,66 @@
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)}"],
+ ["-chronik", f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}:t"],
"Error: The -chronikelectrumbind option requires -chronikscripthashindex to be true.",
)
- self.node.stop_node()
self.node.assert_start_raises_init_error(
[
"-chronik",
- f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
+ f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}:t",
"-chronikscripthashindex=0",
],
"Error: The -chronikelectrumbind option requires -chronikscripthashindex to be true.",
)
+ # Chronik Electrum default to TLS if the protocol is not set
+ 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)",
+ )
+ # Same result when the 's' protocol is explicitly set
+ 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)",
+ )
+ self.node.assert_start_raises_init_error(
+ [
+ "-chronik",
+ "-chronikscripthashindex=1",
+ "-chronikelectrumcert=dummy",
+ f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
+ ],
+ "Error: The -chronikelectrumcert and -chronikelectrumprivkey options should both be set or unset.",
+ )
+ self.node.assert_start_raises_init_error(
+ [
+ "-chronik",
+ "-chronikscripthashindex=1",
+ "-chronikelectrumprivkey=dummy",
+ f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
+ ],
+ "Error: The -chronikelectrumcert and -chronikelectrumprivkey options should both be set or unset.",
+ )
+ self.node.assert_start_raises_init_error(
+ [
+ "-chronik",
+ "-chronikscripthashindex=1",
+ "-chronikelectrumcert=dummy",
+ "-chronikelectrumprivkey=dummy",
+ f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
+ ],
+ "Error: Chronik Electrum TLS configuration failed to open the certificate chain file dummy",
+ match=ErrorMatch.PARTIAL_REGEX,
+ )
+
self.start_node(0, self.extra_args[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
@@ -51,7 +51,7 @@
self.extra_args = [
[
"-chronik",
- f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}",
+ f"-chronikelectrumbind=127.0.0.1:{chronikelectrum_port(0)}:t",
"-chronikscripthashindex=1",
]
]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 23:06 (4 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5866132
Default Alt Text
D18112.diff (5 KB)
Attached To
D18112: [chronik] Electrum: Use TLS as a default protocol
Event Timeline
Log In to Comment