| 5305 | } |
| 5306 | |
| 5307 | struct 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 | } |
no test coverage detected