test, contrib: Fix signer/miner command line escaping

Pass bitcoin binary command lines from test framework to signet/miner utility
using shell escaping so they are unambigous and don't get mangled if they
contain spaces.

This change is not needed for tests to pass currently, but is a useful change
to avoid CI failures in followup PR
https://github.com/bitcoin/bitcoin/pull/31375 and to avoid other bugs.
This commit is contained in:
Ryan Ofsky
2024-11-26 11:51:41 -05:00
parent 0d2eefca8b
commit d190f0facc
2 changed files with 7 additions and 6 deletions

View File

@@ -5,6 +5,7 @@
"""Test signet miner tool"""
import os.path
import shlex
import subprocess
import sys
import time
@@ -54,10 +55,10 @@ class SignetMinerTest(BitcoinTestFramework):
subprocess.run([
sys.executable,
signet_miner_path,
f'--cli={" ".join(rpc_argv)}',
f'--cli={shlex.join(rpc_argv)}',
'generate',
f'--address={node.getnewaddress()}',
f'--grind-cmd={" ".join(util_argv)}',
f'--grind-cmd={shlex.join(util_argv)}',
f'--nbits={DIFF_1_N_BITS:08x}',
f'--set-block-time={int(time.time())}',
'--poolnum=99',