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

Function json_waitsendpay

lightningd/pay.c:1669–1699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1667}
1668
1669static struct command_result *json_waitsendpay(struct command *cmd,
1670 const char *buffer,
1671 const jsmntok_t *obj UNNEEDED,
1672 const jsmntok_t *params)
1673{
1674 struct sha256 *rhash;
1675 unsigned int *timeout;
1676 struct command_result *res;
1677 u64 *partid, *groupid;
1678
1679 if (!param(cmd, buffer, params,
1680 p_req("payment_hash", param_sha256, &rhash),
1681 p_opt("timeout", param_number, &timeout),
1682 p_opt_def("partid", param_u64, &partid, 0),
1683 p_opt("groupid", param_u64, &groupid),
1684 NULL))
1685 return command_param_failed();
1686
1687 if (groupid == NULL) {
1688 groupid = tal(cmd, u64);
1689 *groupid = wallet_payment_get_groupid(cmd->ld->wallet, rhash);
1690 }
1691 res = wait_payment(cmd->ld, cmd, rhash, *partid, *groupid);
1692 if (res)
1693 return res;
1694
1695 if (timeout)
1696 new_reltimer(cmd->ld->timers, cmd, time_from_sec(*timeout),
1697 &waitsendpay_timeout, cmd);
1698 return command_still_pending(cmd);
1699}
1700
1701static const struct json_command waitsendpay_command = {
1702 "waitsendpay",

Callers

nothing calls this directly

Calls 6

wait_paymentFunction · 0.85
time_from_secFunction · 0.85
command_param_failedFunction · 0.70
command_still_pendingFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected