|
|
@ -213,16 +213,16 @@ class TestNodeCLI(): |
|
|
|
"""Interface to bitcoin-cli for an individual node""" |
|
|
|
"""Interface to bitcoin-cli for an individual node""" |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, binary, datadir): |
|
|
|
def __init__(self, binary, datadir): |
|
|
|
self.args = [] |
|
|
|
self.options = [] |
|
|
|
self.binary = binary |
|
|
|
self.binary = binary |
|
|
|
self.datadir = datadir |
|
|
|
self.datadir = datadir |
|
|
|
self.input = None |
|
|
|
self.input = None |
|
|
|
self.log = logging.getLogger('TestFramework.bitcoincli') |
|
|
|
self.log = logging.getLogger('TestFramework.bitcoincli') |
|
|
|
|
|
|
|
|
|
|
|
def __call__(self, *args, input=None): |
|
|
|
def __call__(self, *options, input=None): |
|
|
|
# TestNodeCLI is callable with bitcoin-cli command-line args |
|
|
|
# TestNodeCLI is callable with bitcoin-cli command-line options |
|
|
|
cli = TestNodeCLI(self.binary, self.datadir) |
|
|
|
cli = TestNodeCLI(self.binary, self.datadir) |
|
|
|
cli.args = [str(arg) for arg in args] |
|
|
|
cli.options = [str(o) for o in options] |
|
|
|
cli.input = input |
|
|
|
cli.input = input |
|
|
|
return cli |
|
|
|
return cli |
|
|
|
|
|
|
|
|
|
|
@ -244,7 +244,7 @@ class TestNodeCLI(): |
|
|
|
pos_args = [str(arg) for arg in args] |
|
|
|
pos_args = [str(arg) for arg in args] |
|
|
|
named_args = [str(key) + "=" + str(value) for (key, value) in kwargs.items()] |
|
|
|
named_args = [str(key) + "=" + str(value) for (key, value) in kwargs.items()] |
|
|
|
assert not (pos_args and named_args), "Cannot use positional arguments and named arguments in the same bitcoin-cli call" |
|
|
|
assert not (pos_args and named_args), "Cannot use positional arguments and named arguments in the same bitcoin-cli call" |
|
|
|
p_args = [self.binary, "-datadir=" + self.datadir] + self.args |
|
|
|
p_args = [self.binary, "-datadir=" + self.datadir] + self.options |
|
|
|
if named_args: |
|
|
|
if named_args: |
|
|
|
p_args += ["-named"] |
|
|
|
p_args += ["-named"] |
|
|
|
p_args += [command] + pos_args + named_args |
|
|
|
p_args += [command] + pos_args + named_args |
|
|
|