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

Function payment_get_details

wallet/wallet.c:4231–4273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4229}
4230
4231struct wallet_payment *payment_get_details(const tal_t *ctx,
4232 struct db_stmt *stmt)
4233{
4234 struct wallet_payment *payment;
4235 u32 *completed_at;
4236 struct sha256 payment_hash;
4237
4238 db_col_sha256(stmt, "payment_hash", &payment_hash);
4239
4240 if (!db_col_is_null(stmt, "completed_at")) {
4241 completed_at = tal(tmpctx, u32);
4242 *completed_at = db_col_int(stmt, "completed_at");
4243 } else
4244 completed_at = NULL;
4245
4246 payment = wallet_payment_new(ctx,
4247 db_col_u64(stmt, "id"),
4248 db_col_u64(stmt, "updated_index"),
4249 db_col_int(stmt, "timestamp"),
4250 completed_at,
4251 &payment_hash,
4252 db_col_is_null(stmt, "partid") ? 0 : db_col_u64(stmt, "partid"),
4253 db_col_u64(stmt, "groupid"),
4254 payment_status_in_db(db_col_int(stmt, "status")),
4255 take(db_col_optional(NULL, stmt, "destination", node_id)),
4256 db_col_amount_msat(stmt, "msatoshi"),
4257 db_col_amount_msat(stmt, "msatoshi_sent"),
4258 db_col_is_null(stmt, "total_msat") ? AMOUNT_MSAT(0) : db_col_amount_msat(stmt, "total_msat"),
4259 take(db_col_optional(NULL, stmt, "payment_preimage", preimage)),
4260 take(db_col_secret_arr(NULL, stmt, "path_secrets")),
4261 take(db_col_node_id_arr(NULL, stmt, "route_nodes")),
4262 take(db_col_short_channel_id_arr(NULL, stmt, "route_channels")),
4263 take(db_col_strdup_optional(NULL, stmt, "bolt11")),
4264 take(db_col_strdup_optional(NULL, stmt, "description")),
4265 take(db_col_strdup_optional(NULL, stmt, "paydescription")),
4266 take(db_col_arr(NULL, stmt, "failonionreply", u8)),
4267 take(db_col_optional(NULL, stmt, "local_invreq_id", sha256)));
4268
4269 /* Either none, or both are set */
4270 assert(db_col_is_null(stmt, "route_nodes")
4271 == db_col_is_null(stmt, "route_channels"));
4272 return payment;
4273}
4274
4275struct wallet_payment *
4276wallet_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