db: Fix size mismatch on postgres in a migration

Changelog-Fixed: db: Fixed a broken migration on postgres DBs that had really old channels.
This commit is contained in:
Christian Decker 2020-09-18 16:15:25 +02:00 committed by Rusty Russell
parent a08e83522b
commit de7b41695f
4 changed files with 5 additions and 5 deletions

View File

@ -1253,7 +1253,7 @@ static void fillin_missing_channel_id(struct lightningd *ld, struct db *db,
struct channel_id cid;
u32 outnum;
id = db_column_int(stmt, 0);
id = db_column_u64(stmt, 0);
db_column_txid(stmt, 1, &funding_txid);
outnum = db_column_int(stmt, 2);
derive_channel_id(&cid, &funding_txid, outnum);
@ -1262,7 +1262,7 @@ static void fillin_missing_channel_id(struct lightningd *ld, struct db *db,
" SET full_channel_id = ?"
" WHERE id = ?;"));
db_bind_channel_id(update_stmt, 0, &cid);
db_bind_int(update_stmt, 1, id);
db_bind_u64(update_stmt, 1, id);
db_exec_prepared_v2(update_stmt);
tal_free(update_stmt);

View File

@ -1654,4 +1654,4 @@ struct db_query db_postgres_queries[] = {
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:f1774aa3e2db5c35ba14d6b53f86fc6dabe7e2d55246e0038c0a8585710d31af
// SHA256STAMP:f87b55286c80cc692daa892dd21fe22e3a754c87a6f93bd05e22a443e93b2a61

View File

@ -1654,4 +1654,4 @@ struct db_query db_sqlite3_queries[] = {
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
// SHA256STAMP:f1774aa3e2db5c35ba14d6b53f86fc6dabe7e2d55246e0038c0a8585710d31af
// SHA256STAMP:f87b55286c80cc692daa892dd21fe22e3a754c87a6f93bd05e22a443e93b2a61

View File

@ -1089,4 +1089,4 @@ msgstr ""
#: wallet/test/run-wallet.c:1359
msgid "INSERT INTO channels (id) VALUES (1);"
msgstr ""
# SHA256STAMP:a1832341c9266200a72273ec60e727150da9425e9b5c180b0042bb3f160f1f59
# SHA256STAMP:b86ada480023c65c47b0b8b795e706125134521e717c731e2af2fbe4a5877db5