MCPcopy Create free account
hub / github.com/ElementsProject/lightning / migrate_our_funding

Function migrate_our_funding

wallet/db.c:1050–1065  ·  view source on GitHub ↗

We've added a column `our_funding_satoshis`, since channels can now * have funding for either channel participant. We need to 'backfill' this * data, however. We can do this using the fact that our_funding_satoshi * is the same as the funding_satoshi for every channel where we are * the `funder` */

Source from the content-addressed store, hash-verified

1048 * the `funder`
1049 */
1050static void migrate_our_funding(struct lightningd *ld, struct db *db,
1051 const struct migration_context *mc)
1052{
1053 struct db_stmt *stmt;
1054
1055 /* Statement to update record */
1056 stmt = db_prepare_v2(db, SQL("UPDATE channels"
1057 " SET our_funding_satoshi = funding_satoshi"
1058 " WHERE funder = 0;")); /* 0 == LOCAL */
1059 db_exec_prepared_v2(stmt);
1060 if (stmt->error)
1061 db_fatal("Error migrating funding satoshis to our_funding (%s)",
1062 stmt->error);
1063
1064 tal_free(stmt);
1065}
1066
1067void fillin_missing_scriptpubkeys(struct lightningd *ld, struct db *db,
1068 const struct migration_context *mc)

Callers

nothing calls this directly

Calls 3

db_exec_prepared_v2Function · 0.85
tal_freeFunction · 0.85
db_fatalFunction · 0.70

Tested by

no test coverage detected