mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +01:00
db: Store the alias if that's all we got in a forward
This commit is contained in:
parent
a4e6b58fa4
commit
2dc86bf29b
1 changed files with 12 additions and 1 deletions
|
@ -4334,6 +4334,7 @@ void wallet_forwarded_payment_add(struct wallet *w, const struct htlc_in *in,
|
|||
{
|
||||
struct db_stmt *stmt;
|
||||
struct timeabs *resolved_time;
|
||||
struct channel *outchan;
|
||||
|
||||
if (state == FORWARD_SETTLED || state == FORWARD_FAILED) {
|
||||
resolved_time = tal(tmpctx, struct timeabs);
|
||||
|
@ -4362,8 +4363,18 @@ void wallet_forwarded_payment_add(struct wallet *w, const struct htlc_in *in,
|
|||
db_bind_u64(stmt, 0, in->dbid);
|
||||
|
||||
if (out) {
|
||||
outchan = out->key.channel;
|
||||
db_bind_u64(stmt, 1, out->dbid);
|
||||
db_bind_u64(stmt, 3, out->key.channel->scid->u64);
|
||||
|
||||
/* IF we forward we must have a name for this
|
||||
* channel. It can be either a locally assigned alias,
|
||||
* or the real scid. */
|
||||
assert(outchan->scid != NULL || outchan->alias[LOCAL]);
|
||||
if (out->key.channel->scid)
|
||||
db_bind_u64(stmt, 3, outchan->scid->u64);
|
||||
else
|
||||
db_bind_u64(stmt, 3, outchan->alias[LOCAL]->u64);
|
||||
|
||||
db_bind_amount_msat(stmt, 5, &out->msat);
|
||||
} else {
|
||||
/* FORWARD_LOCAL_FAILED may occur before we get htlc_out */
|
||||
|
|
Loading…
Add table
Reference in a new issue