| 3527 | } |
| 3528 | |
| 3529 | const struct wallet_payment ** |
| 3530 | wallet_payment_list(const tal_t *ctx, |
| 3531 | struct wallet *wallet, |
| 3532 | const struct sha256 *payment_hash) |
| 3533 | { |
| 3534 | const struct wallet_payment **payments; |
| 3535 | struct db_stmt *stmt; |
| 3536 | struct wallet_payment *p; |
| 3537 | size_t i; |
| 3538 | |
| 3539 | payments = tal_arr(ctx, const struct wallet_payment *, 0); |
| 3540 | |
| 3541 | if (payment_hash) { |
| 3542 | stmt = db_prepare_v2(wallet->db, SQL("SELECT" |
| 3543 | " id" |
| 3544 | ", status" |
| 3545 | ", destination" |
| 3546 | ", msatoshi" |
| 3547 | ", payment_hash" |
| 3548 | ", timestamp" |
| 3549 | ", payment_preimage" |
| 3550 | ", path_secrets" |
| 3551 | ", route_nodes" |
| 3552 | ", route_channels" |
| 3553 | ", msatoshi_sent" |
| 3554 | ", description" |
| 3555 | ", bolt11" |
| 3556 | ", paydescription" |
| 3557 | ", failonionreply" |
| 3558 | ", total_msat" |
| 3559 | ", partid" |
| 3560 | ", local_offer_id" |
| 3561 | ", groupid" |
| 3562 | ", completed_at" |
| 3563 | " FROM payments" |
| 3564 | " WHERE" |
| 3565 | " payment_hash = ?" |
| 3566 | " ORDER BY id;")); |
| 3567 | db_bind_sha256(stmt, 0, payment_hash); |
| 3568 | } else { |
| 3569 | stmt = db_prepare_v2(wallet->db, SQL("SELECT" |
| 3570 | " id" |
| 3571 | ", status" |
| 3572 | ", destination" |
| 3573 | ", msatoshi" |
| 3574 | ", payment_hash" |
| 3575 | ", timestamp" |
| 3576 | ", payment_preimage" |
| 3577 | ", path_secrets" |
| 3578 | ", route_nodes" |
| 3579 | ", route_channels" |
| 3580 | ", msatoshi_sent" |
| 3581 | ", description" |
| 3582 | ", bolt11" |
| 3583 | ", paydescription" |
| 3584 | ", failonionreply" |
| 3585 | ", total_msat" |
| 3586 | ", partid" |
no test coverage detected