wallet: don't BROKEN log id payments.total_msat is null.

This was changed by mistake in 23fafe98e3: if
it's null we turn it into 0 (which is what the default call does, but it
does log BROKEN about it!):

```
2023-08-03T14:10:49.001Z **BROKEN** lightningd: Accessing a null column total_msat/15 in query SELECT  id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, paydescription, failonionreply, total_msat, partid, local_invreq_id, groupid, completed_at FROM payments ORDER BY id;
```

Fixes: #6501
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-08-04 12:49:43 +09:30
parent 86d63a16ca
commit 881d7efd6e

View File

@ -3444,7 +3444,7 @@ static struct wallet_payment *wallet_stmt2payment(const tal_t *ctx,
take(db_col_optional(NULL, stmt, "destination", node_id)),
db_col_amount_msat(stmt, "msatoshi"),
db_col_amount_msat(stmt, "msatoshi_sent"),
db_col_amount_msat(stmt, "total_msat"),
db_col_is_null(stmt, "total_msat") ? AMOUNT_MSAT(0) : db_col_amount_msat(stmt, "total_msat"),
take(db_col_optional(NULL, stmt, "payment_preimage", preimage)),
take(db_col_secret_arr(NULL, stmt, "path_secrets")),
take(db_col_node_id_arr(NULL, stmt, "route_nodes")),