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

Function wallet_htlcs_next

wallet/wallet.c:5307–5340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5305}
5306
5307struct wallet_htlc_iter *wallet_htlcs_next(struct wallet *w,
5308 struct wallet_htlc_iter *iter,
5309 struct short_channel_id *scid,
5310 u64 *htlc_id,
5311 int *cltv_expiry,
5312 enum side *owner,
5313 struct amount_msat *msat,
5314 struct sha256 *payment_hash,
5315 enum htlc_state *hstate)
5316{
5317 if (!db_step(iter->stmt))
5318 return tal_free(iter);
5319
5320 if (iter->scid.u64 != 0)
5321 *scid = iter->scid;
5322 else {
5323 if (db_col_is_null(iter->stmt, "channels.scid"))
5324 db_col_scid(iter->stmt, "channels.alias_local", scid);
5325 else {
5326 db_col_scid(iter->stmt, "channels.scid", scid);
5327 db_col_ignore(iter->stmt, "channels.alias_local");
5328 }
5329 }
5330 *htlc_id = db_col_u64(iter->stmt, "h.channel_htlc_id");
5331 if (db_col_int(iter->stmt, "h.direction") == DIRECTION_INCOMING)
5332 *owner = REMOTE;
5333 else
5334 *owner = LOCAL;
5335 db_col_amount_msat(iter->stmt, "h.msatoshi", msat);
5336 db_col_sha256(iter->stmt, "h.payment_hash", payment_hash);
5337 *cltv_expiry = db_col_int(iter->stmt, "h.cltv_expiry");
5338 *hstate = db_col_int(iter->stmt, "h.hstate");
5339 return iter;
5340}

Callers 2

wallet_htlcs_firstFunction · 0.85
json_listhtlcsFunction · 0.85

Calls 9

db_stepFunction · 0.85
tal_freeFunction · 0.85
db_col_is_nullFunction · 0.85
db_col_scidFunction · 0.85
db_col_ignoreFunction · 0.85
db_col_u64Function · 0.85
db_col_intFunction · 0.85
db_col_amount_msatFunction · 0.85
db_col_sha256Function · 0.85

Tested by

no test coverage detected