Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864668
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Subscribers
None
View Options
diff --git a/chronik/chronik-cpp/chronik.cpp b/chronik/chronik-cpp/chronik.cpp
index 66506605b..018205b6a 100644
--- a/chronik/chronik-cpp/chronik.cpp
+++ b/chronik/chronik-cpp/chronik.cpp
@@ -124,7 +124,7 @@ ParseChronikParams(const ArgsManager &args, const Config &config, bool fWipe) {
},
.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
index 3d432682e..de5bbad79 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -727,7 +727,7 @@ void SetupServerArgs(NodeContext &node) {
"'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
index 8f71e09b4..beacf496f 100644
--- a/test/functional/chronik_electrum_basic.py
+++ b/test/functional/chronik_electrum_basic.py
@@ -6,6 +6,7 @@ Test Chronik's electrum interface
"""
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 @@ class ChronikElectrumBasic(BitcoinTestFramework):
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 @@ class ChronikElectrumBasic(BitcoinTestFramework):
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
index 37d5dd2e5..1014a2f76 100644
--- a/test/functional/chronik_electrum_blockchain.py
+++ b/test/functional/chronik_electrum_blockchain.py
@@ -51,7 +51,7 @@ class ChronikElectrumBlockchain(BitcoinTestFramework):
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/x-diff
Expires
Wed, May 21, 21:31 (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865970
Default Alt Text
(6 KB)
Attached To
rABC Bitcoin ABC
Event Timeline
Log In to Comment