mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
pytest: add (failing) test for db with old Tor v2 address.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a0c6447611
commit
37403e471c
@ -2605,3 +2605,13 @@ def test_datastore_keylist(node_factory):
|
||||
'string': 'ab2val2',
|
||||
'generation': 1,
|
||||
'hex': b'ab2val2'.hex()}]}
|
||||
|
||||
|
||||
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3',
|
||||
"This test requires sqlite3")
|
||||
def test_torv2_in_db(node_factory):
|
||||
l1, l2 = node_factory.line_graph(2, wait_for_announce=True)
|
||||
|
||||
l1.stop()
|
||||
l1.db_manip("UPDATE peers SET address='3fyb44wdhnd2ghhl.onion:1234';")
|
||||
l1.start()
|
||||
|
@ -836,10 +836,15 @@ static struct peer *wallet_peer_load(struct wallet *w, const u64 dbid)
|
||||
|
||||
db_col_node_id(stmt, "node_id", &id);
|
||||
|
||||
/* This can happen for peers last seen on Torv2! */
|
||||
addrstr = db_col_strdup(tmpctx, stmt, "address");
|
||||
if (!parse_wireaddr_internal(addrstr, &addr, DEFAULT_PORT,
|
||||
false, false, true, true, NULL))
|
||||
goto done;
|
||||
false, false, true, true, NULL)) {
|
||||
log_unusual(w->log, "Unparsable peer address %s: replacing",
|
||||
addrstr);
|
||||
parse_wireaddr_internal("127.0.0.1:1", &addr, DEFAULT_PORT,
|
||||
false, false, true, true, NULL);
|
||||
}
|
||||
|
||||
/* FIXME: save incoming in db! */
|
||||
peer = new_peer(w->ld, db_col_u64(stmt, "id"), &id, &addr, false);
|
||||
|
Loading…
Reference in New Issue
Block a user