pytest: use _ not - in plugin options to zeroconf-selective.py.
What changed, and why it matters
This is a test-only change that renames plugin option names from using hyphens (zeroconf-allow, zeroconf-mindepth) to underscores (zeroconf_allow, zeroconf_mindepth). It only affects test files and a test helper plugin, making the tests work correctly with pytest's option handling. There is no security issue here.
No security action required. This is a benign test maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies tests/plugins/zeroconf-selective.py and several test files to use underscore-separated option names instead of hyphen-separated ones. This is because pytest/clightning plugin option handling normalizes or requires underscore-style option names when passed via plugin_start or configuration. The change is purely syntactic/test infrastructure and does not alter any runtime behavior of Core Lightning itself.
Changed components
tests/plugins/zeroconf-selective.pytests/test_misc.pytests/test_opening.pytests/test_pay.pytests/test_xpay.pyInspect captured patch +17 / −17
diff --git a/tests/plugins/zeroconf-selective.py b/tests/plugins/zeroconf-selective.py
index b359a206..527e1228 100755
--- a/tests/plugins/zeroconf-selective.py
+++ b/tests/plugins/zeroconf-selective.py
@@ -10,9 +10,9 @@ plugin = Plugin()
@plugin.hook('openchannel')
def on_openchannel(openchannel, plugin, **kwargs):
plugin.log(repr(openchannel))
- mindepth = int(plugin.options['zeroconf-mindepth']['value'])
+ mindepth = int(plugin.options['zeroconf_mindepth']['value'])
- if openchannel['id'] == plugin.options['zeroconf-allow']['value'] or plugin.options['zeroconf-allow']['value'] == 'any':
+ if openchannel['id'] == plugin.options['zeroconf_allow']['value'] or plugin.options['zeroconf_allow']['value'] == 'any':
plugin.log(f"This peer is in the zeroconf allowlist, setting mindepth={mindepth}")
return {'result': 'continue', 'mindepth': mindepth}
else:
@@ -20,13 +20,13 @@ def on_openchannel(openchannel, plugin, **kwargs):
plugin.add_option(
- 'zeroconf-allow',
+ 'zeroconf_allow',
'03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f',
'A node_id to allow zeroconf channels from',
)
plugin.add_option(
- 'zeroconf-mindepth',
+ 'zeroconf_mindepth',
0,
'Number of confirmations to require from allowlisted peers',
)
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 5f2ffb39..81e308fd 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -1390,7 +1390,7 @@ def test_funding_reorg_private(node_factory, bitcoind):
'dev-fast-reconnect': None,
# if it's not zeroconf, we'll terminate on reorg.
'plugin': os.path.join(os.getcwd(), 'tests/plugins/zeroconf-selective.py'),
- 'zeroconf-allow': 'any'}
+ 'zeroconf_allow': 'any'}
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts=opts)
l1.fundwallet(10000000)
sync_blockheight(bitcoind, [l1]) # height 102
@@ -1433,7 +1433,7 @@ def test_funding_reorg_remote_lags(node_factory, bitcoind):
'allow_warning': True, 'dev-fast-reconnect': None,
# if it's not zeroconf, l2 will terminate on reorg.
'plugin': os.path.join(os.getcwd(), 'tests/plugins/zeroconf-selective.py'),
- 'zeroconf-allow': 'any'}
+ 'zeroconf_allow': 'any'}
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts=opts)
l1.fundwallet(10000000)
sync_blockheight(bitcoind, [l1]) # height 102
diff --git a/tests/test_opening.py b/tests/test_opening.py
index 7c086dc7..fd5bf2a9 100644
--- a/tests/test_opening.py
+++ b/tests/test_opening.py
@@ -1580,8 +1580,8 @@ def test_zeroconf_mindepth(bitcoind, node_factory):
{},
{
'plugin': str(plugin_path),
- 'zeroconf-allow': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518',
- 'zeroconf-mindepth': '2',
+ 'zeroconf_allow': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518',
+ 'zeroconf_mindepth': '2',
},
])
@@ -1627,7 +1627,7 @@ def test_zeroconf_open(bitcoind, node_factory):
{},
{
'plugin': str(plugin_path),
- 'zeroconf-allow': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59'
+ 'zeroconf_allow': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59'
},
])
@@ -1702,7 +1702,7 @@ def test_zeroconf_public(bitcoind, node_factory, chainparams):
{'plugin': str(coin_mvt_plugin)},
{
'plugin': str(plugin_path),
- 'zeroconf-allow': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518'
+ 'zeroconf_allow': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518'
},
{}
])
@@ -1804,7 +1804,7 @@ def test_zeroconf_forward(node_factory, bitcoind):
{},
{
'plugin': str(plugin_path),
- 'zeroconf-allow': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59'
+ 'zeroconf_allow': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59'
}
]
l1, l2, l3 = node_factory.get_nodes(3, opts=opts)
@@ -2054,7 +2054,7 @@ def test_zeroconf_multichan_forward(node_factory):
{},
{
'plugin': str(plugin_path),
- 'zeroconf-allow': node_id,
+ 'zeroconf_allow': node_id,
}
], fundamount=10**6, wait_for_announce=True)
@@ -2574,7 +2574,7 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
l1, l2, l3, l4 = node_factory.get_nodes(4,
opts=[{'experimental-dual-fund': None},
{'plugin': str(plugin_path),
- 'zeroconf-allow': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518'},
+ 'zeroconf_allow': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518'},
{'experimental-dual-fund': None},
{}])
@@ -2707,8 +2707,8 @@ def test_zeroconf_forget(node_factory, bitcoind, dopay: bool):
{},
{
"plugin": str(plugin_path),
- "zeroconf-allow": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
- "zeroconf-mindepth": "0",
+ "zeroconf_allow": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
+ "zeroconf_mindepth": "0",
"dev-max-funding-unconfirmed-blocks": blocks,
},
{},
diff --git a/tests/test_pay.py b/tests/test_pay.py
index 9a2f58b9..5e26b7e4 100644
--- a/tests/test_pay.py
+++ b/tests/test_pay.py
@@ -5343,7 +5343,7 @@ def test_pay_multichannel_use_zeroconf(bitcoind, node_factory):
fundamount=200_000,
opts=[{},
{'plugin': zeroconf_plugin,
- 'zeroconf-allow': 'any'}])
+ 'zeroconf_allow': 'any'}])
# 1. Open a zeoconf channel l1 -> l2
zeroconf_sats = 1_000_000
diff --git a/tests/test_xpay.py b/tests/test_xpay.py
index d895e51f..f99764ea 100644
--- a/tests/test_xpay.py
+++ b/tests/test_xpay.py
@@ -604,7 +604,7 @@ def test_xpay_zeroconf(node_factory):
l1, l2 = node_factory.get_nodes(2,
opts=[{},
{'plugin': zeroconf_plugin,
- 'zeroconf-allow': 'any'}])
+ 'zeroconf_allow': 'any'}])
l1.fundwallet(FUNDAMOUNT * 2)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.