mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 08:04:26 +01:00
pyln: Allow non-empty directory when creating node in node_factory
So far we've always cleared the node directory when provisioning the node, but while testing some plugins we noticed that pre-generating some files in that directory is useful. This just adds yet another flag to `get_node` that disables deleting any existing node directory.
This commit is contained in:
committed by
Rusty Russell
parent
b68066e8e8
commit
3b09662768
@@ -1011,7 +1011,8 @@ class NodeFactory(object):
|
|||||||
|
|
||||||
def get_node(self, node_id=None, options=None, dbfile=None,
|
def get_node(self, node_id=None, options=None, dbfile=None,
|
||||||
feerates=(15000, 11000, 7500, 3750), start=True,
|
feerates=(15000, 11000, 7500, 3750), start=True,
|
||||||
wait_for_bitcoind_sync=True, expect_fail=False, **kwargs):
|
wait_for_bitcoind_sync=True, expect_fail=False,
|
||||||
|
cleandir=True, **kwargs):
|
||||||
|
|
||||||
node_id = self.get_node_id() if not node_id else node_id
|
node_id = self.get_node_id() if not node_id else node_id
|
||||||
port = self.get_next_port()
|
port = self.get_next_port()
|
||||||
@@ -1019,7 +1020,7 @@ class NodeFactory(object):
|
|||||||
lightning_dir = os.path.join(
|
lightning_dir = os.path.join(
|
||||||
self.directory, "lightning-{}/".format(node_id))
|
self.directory, "lightning-{}/".format(node_id))
|
||||||
|
|
||||||
if os.path.exists(lightning_dir):
|
if cleandir and os.path.exists(lightning_dir):
|
||||||
shutil.rmtree(lightning_dir)
|
shutil.rmtree(lightning_dir)
|
||||||
|
|
||||||
# Get the DB backend DSN we should be using for this test and this
|
# Get the DB backend DSN we should be using for this test and this
|
||||||
|
|||||||
Reference in New Issue
Block a user