From 396e8224fa0d9a4bc1649810c217878b006c3247 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sun, 20 Oct 2019 23:04:50 +0200 Subject: [PATCH] db: Add a migration to set received_time on forwards in rare cases The case where this is needed is when the wallet had a forwarded payment somewhere between commits 66a47d2 (which started tracking forwardings) and d901304 (which added the `received_time` column). This just emulates the behavior of sqlite3 for postgres as well. Signed-off-by: Christian Decker <@cdecker> --- wallet/db.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wallet/db.c b/wallet/db.c index a1264066b..713a388ae 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -477,6 +477,9 @@ static struct migration dbmigrations[] = { ");"), NULL}, {SQL("ALTER TABLE channels ADD shutdown_scriptpubkey_local BLOB;"), NULL}, + /* See https://github.com/ElementsProject/lightning/issues/3189 */ + {SQL("UPDATE forwarded_payments SET received_time=0 WHERE received_time IS NULL;"), + NULL}, }; /* Leak tracking. */