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

Function payment_get_details

wallet/wallet.c:4194–4236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4192}
4193
4194struct wallet_payment *payment_get_details(const tal_t *ctx,
4195 struct db_stmt *stmt)
4196{
4197 struct wallet_payment *payment;
4198 u32 *completed_at;
4199 struct sha256 payment_hash;
4200
4201 db_col_sha256(stmt, "payment_hash", &payment_hash);
4202
4203 if (!db_col_is_null(stmt, "completed_at")) {
4204 completed_at = tal(tmpctx, u32);
4205 *completed_at = db_col_int(stmt, "completed_at");
4206 } else
4207 completed_at = NULL;
4208
4209 payment = wallet_payment_new(ctx,
4210 db_col_u64(stmt, "id"),
4211 db_col_u64(stmt, "updated_index"),
4212 db_col_int(stmt, "timestamp"),
4213 completed_at,
4214 &payment_hash,
4215 db_col_is_null(stmt, "partid") ? 0 : db_col_u64(stmt, "partid"),
4216 db_col_u64(stmt, "groupid"),
4217 payment_status_in_db(db_col_int(stmt, "status")),
4218 take(db_col_optional(NULL, stmt, "destination", node_id)),
4219 db_col_amount_msat(stmt, "msatoshi"),
4220 db_col_amount_msat(stmt, "msatoshi_sent"),
4221 db_col_is_null(stmt, "total_msat") ? AMOUNT_MSAT(0) : db_col_amount_msat(stmt, "total_msat"),
4222 take(db_col_optional(NULL, stmt, "payment_preimage", preimage)),
4223 take(db_col_secret_arr(NULL, stmt, "path_secrets")),
4224 take(db_col_node_id_arr(NULL, stmt, "route_nodes")),
4225 take(db_col_short_channel_id_arr(NULL, stmt, "route_channels")),
4226 take(db_col_strdup_optional(NULL, stmt, "bolt11")),
4227 take(db_col_strdup_optional(NULL, stmt, "description")),
4228 take(db_col_strdup_optional(NULL, stmt, "paydescription")),
4229 take(db_col_arr(NULL, stmt, "failonionreply", u8)),
4230 take(db_col_optional(NULL, stmt, "local_invreq_id", sha256)));
4231
4232 /* Either none, or both are set */
4233 assert(db_col_is_null(stmt, "route_nodes")
4234 == db_col_is_null(stmt, "route_channels"));
4235 return payment;
4236}
4237
4238struct wallet_payment *
4239wallet_payment_by_hash(const tal_t *ctx, struct wallet *wallet,

Callers 6

wallet_payment_by_hashFunction · 0.85
check_progressFunction · 0.85
json_listsendpaysFunction · 0.85
json_delpayFunction · 0.85
prev_paymentFunction · 0.85

Calls 11

db_col_sha256Function · 0.85
db_col_is_nullFunction · 0.85
db_col_intFunction · 0.85
wallet_payment_newFunction · 0.85
db_col_u64Function · 0.85
payment_status_in_dbFunction · 0.85
db_col_amount_msatFunction · 0.85
db_col_secret_arrFunction · 0.85
db_col_node_id_arrFunction · 0.85
db_col_strdup_optionalFunction · 0.85

Tested by

no test coverage detected