mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-02 20:54:23 +01:00
wallet: Record the received_time and resolved_time for HTLCs
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
2ce9a1e10d
commit
75de2e2f3c
@@ -377,6 +377,8 @@ static struct migration dbmigrations[] = {
|
||||
{ "ALTER TABLE channels ADD feerate_ppm INTEGER;", NULL },
|
||||
{ NULL, migrate_pr2342_feerate_per_channel },
|
||||
{ "ALTER TABLE channel_htlcs ADD received_time INTEGER", NULL },
|
||||
{ "ALTER TABLE forwarded_payments ADD received_time INTEGER", NULL },
|
||||
{ "ALTER TABLE forwarded_payments ADD resolved_time INTEGER", NULL },
|
||||
};
|
||||
|
||||
/* Leak tracking. */
|
||||
|
||||
@@ -2492,7 +2492,10 @@ void wallet_forwarded_payment_add(struct wallet *w, const struct htlc_in *in,
|
||||
", out_channel_scid"
|
||||
", in_msatoshi"
|
||||
", out_msatoshi"
|
||||
", state) VALUES (?, ?, ?, ?, ?, ?, ?);");
|
||||
", state"
|
||||
", received_time"
|
||||
", resolved_time"
|
||||
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);");
|
||||
sqlite3_bind_int64(stmt, 1, in->dbid);
|
||||
sqlite3_bind_int64(stmt, 2, out->dbid);
|
||||
sqlite3_bind_int64(stmt, 3, in->key.channel->scid->u64);
|
||||
@@ -2500,6 +2503,13 @@ void wallet_forwarded_payment_add(struct wallet *w, const struct htlc_in *in,
|
||||
sqlite3_bind_amount_msat(stmt, 5, in->msat);
|
||||
sqlite3_bind_amount_msat(stmt, 6, out->msat);
|
||||
sqlite3_bind_int(stmt, 7, wallet_forward_status_in_db(state));
|
||||
sqlite3_bind_timeabs(stmt, 8, in->received_time);
|
||||
|
||||
if (state == FORWARD_SETTLED || state == FORWARD_FAILED)
|
||||
sqlite3_bind_timeabs(stmt, 9, time_now());
|
||||
else
|
||||
sqlite3_bind_null(stmt, 9);
|
||||
|
||||
db_exec_prepared(w->db, stmt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user