(bitcoind, node_factory)
| 461 | |
| 462 | @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Don't know how to swap dbs in Postgres") |
| 463 | def test_db_sanity_checks(bitcoind, node_factory): |
| 464 | l1, l2 = node_factory.get_nodes(2, opts=[{'may_fail': True, 'broken_log': 'Wallet node_id does not match HSM|Wallet blockchain hash does not match network blockchain hash'}, {}]) |
| 465 | |
| 466 | l1.stop() |
| 467 | l2.stop() |
| 468 | |
| 469 | # Provide the --wallet option and start with wrong db |
| 470 | l1.daemon.opts['wallet'] = "sqlite3://" + l2.db.path |
| 471 | l1.daemon.start(wait_for_initialized=False, stderr_redir=True) |
| 472 | l1.daemon.wait_for_log(r'\*\*BROKEN\*\* wallet: Wallet node_id does not match HSM') |
| 473 | # Will have exited with non-zero status. |
| 474 | assert l1.daemon.proc.wait(TIMEOUT) != 0 |
| 475 | assert l1.daemon.is_in_stderr('Wallet sanity check failed') |
| 476 | |
| 477 | # Now try wrong network, |
| 478 | l1.daemon.opts['wallet'] = "sqlite3://" + l1.db.path |
| 479 | l1.daemon.opts['network'] = "bitcoin" |
| 480 | |
| 481 | l1.daemon.start(wait_for_initialized=False, stderr_redir=True) |
| 482 | l1.daemon.wait_for_log(r'\*\*BROKEN\*\* wallet: Wallet blockchain hash does not match network blockchain hash') |
| 483 | # Will have exited with non-zero status. |
| 484 | assert l1.daemon.proc.wait(TIMEOUT) != 0 |
| 485 | assert l1.daemon.is_in_stderr('Wallet sanity check failed') |
| 486 | |
| 487 | |
| 488 | @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Canned db used") |
nothing calls this directly
no test coverage detected