| 1506 | } |
| 1507 | |
| 1508 | static struct command_result *json_waitsendpay(struct command *cmd, |
| 1509 | const char *buffer, |
| 1510 | const jsmntok_t *obj UNNEEDED, |
| 1511 | const jsmntok_t *params) |
| 1512 | { |
| 1513 | struct sha256 *rhash; |
| 1514 | unsigned int *timeout; |
| 1515 | struct command_result *res; |
| 1516 | u64 *partid, *groupid; |
| 1517 | |
| 1518 | if (!param(cmd, buffer, params, |
| 1519 | p_req("payment_hash", param_sha256, &rhash), |
| 1520 | p_opt("timeout", param_number, &timeout), |
| 1521 | p_opt_def("partid", param_u64, &partid, 0), |
| 1522 | p_opt("groupid", param_u64, &groupid), |
| 1523 | NULL)) |
| 1524 | return command_param_failed(); |
| 1525 | |
| 1526 | if (groupid == NULL) { |
| 1527 | groupid = tal(cmd, u64); |
| 1528 | *groupid = wallet_payment_get_groupid(cmd->ld->wallet, rhash); |
| 1529 | } |
| 1530 | res = wait_payment(cmd->ld, cmd, rhash, *partid, *groupid); |
| 1531 | if (res) |
| 1532 | return res; |
| 1533 | |
| 1534 | if (timeout) |
| 1535 | new_reltimer(cmd->ld->timers, cmd, time_from_sec(*timeout), |
| 1536 | &waitsendpay_timeout, cmd); |
| 1537 | return command_still_pending(cmd); |
| 1538 | } |
| 1539 | |
| 1540 | static const struct json_command waitsendpay_command = { |
| 1541 | "waitsendpay", |
nothing calls this directly
no test coverage detected