Skip to content

Commit

Permalink
wallet: Remove onion-decoding information from db on payment success/…
Browse files Browse the repository at this point in the history
…fail.

Fixes: ElementsProject#1177
  • Loading branch information
ZmnSCPxj authored and cdecker committed Mar 21, 2018
1 parent 489d8d0 commit d5d3186
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wallet/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ char *dbmigrations[] = {
"ALTER TABLE payments ADD failchannel BLOB;", /* erring_channel */
"ALTER TABLE payments ADD failupdate BLOB;", /* channel_update - can be NULL*/
/* -- Payment routing failure information ends -- */
/* Delete route data for already succeeded or failed payments */
"UPDATE payments"
" SET path_secrets = NULL"
" , route_nodes = NULL"
" , route_channels = NULL"
" WHERE status <> 0;", /* PAYMENT_PENDING */
NULL,
};

Expand Down
10 changes: 10 additions & 0 deletions wallet/wallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,16 @@ void wallet_payment_set_status(struct wallet *wallet,
sqlite3_bind_sha256(stmt, 2, payment_hash);
db_exec_prepared(wallet->db, stmt);
}
if (newstatus != PAYMENT_PENDING) {
stmt = db_prepare(wallet->db,
"UPDATE payments"
" SET path_secrets = NULL"
" , route_nodes = NULL"
" , route_channels = NULL"
" WHERE payment_hash = ?;");
sqlite3_bind_sha256(stmt, 1, payment_hash);
db_exec_prepared(wallet->db, stmt);
}
}

void wallet_payment_get_failinfo(const tal_t *ctx,
Expand Down

0 comments on commit d5d3186

Please sign in to comment.