| 20 | |
| 21 | class LightningNode(utils.LightningNode): |
| 22 | def __init__(self, *args, **kwargs): |
| 23 | # Yes, we really want to test the local development version, not |
| 24 | # something in out path. |
| 25 | kwargs["executable"] = "lightningd/lightningd" |
| 26 | utils.LightningNode.__init__(self, *args, **kwargs) |
| 27 | |
| 28 | # Avoid socket path name too long on Linux |
| 29 | if os.uname()[0] == 'Linux' and \ |
| 30 | len(str(self.lightning_dir / TEST_NETWORK / 'lightning-rpc')) >= 108: |
| 31 | self.daemon.opts['rpc-file'] = '/proc/self/cwd/lightning-rpc' |
| 32 | |
| 33 | # This is a recent innovation, and we don't want to nail pyln-testing to this version. |
| 34 | self.daemon.opts['dev-crash-after'] = 3600 |
| 35 | |
| 36 | # We have some valgrind suppressions in the `tests/` |
| 37 | # directory, so we can add these to the valgrind configuration |
| 38 | # (not generally true when running pyln-testing, hence why |
| 39 | # it's being done in this specialization, and not in the |
| 40 | # library). |
| 41 | if self.daemon.cmd_line[0] == 'valgrind': |
| 42 | suppressions_path = Path(__file__).parent / "valgrind-suppressions.txt" |
| 43 | self.daemon.cmd_prefix += [ |
| 44 | f"--suppressions={suppressions_path}", |
| 45 | "--gen-suppressions=all" |
| 46 | ] |
| 47 | |
| 48 | # If we opted into checking the DB statements we will attach the dblog |
| 49 | # plugin before starting the node |
| 50 | check_dblog = os.environ.get("TEST_CHECK_DBSTMTS", None) == "1" |
| 51 | db_type = os.environ.get("TEST_DB_PROVIDER", "sqlite3") |
| 52 | if db_type == 'sqlite3' and check_dblog: |
| 53 | dblog = os.path.join(os.path.dirname(__file__), 'plugins', 'dblog.py') |
| 54 | has_dblog = len([o for o in self.daemon.cmd_line if 'dblog.py' in o]) > 0 |
| 55 | if not has_dblog: |
| 56 | # Add as an expanded option so we don't clobber other options. |
| 57 | self.daemon.opts['plugin={}'.format(dblog)] = None |
| 58 | self.daemon.opts['dblog-file'] = 'dblog.sqlite3' |
| 59 | |
| 60 | if db_type == 'postgres' and ('disable-plugin', 'bookkeeper') not in self.daemon.opts.items(): |
| 61 | accts_db = self.db.provider.get_db('', 'accounts', 0) |
| 62 | self.daemon.opts['bookkeeper-db'] = accts_db.get_dsn() |
| 63 | |
| 64 | |
| 65 | class CompatLevel(object): |