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

Function payment_refresh

plugins/renepay/payment.c:69–105  ·  view source on GitHub ↗

Sets state values to ongoing payment */

Source from the content-addressed store, hash-verified

67
68/* Sets state values to ongoing payment */
69bool payment_refresh(struct payment *p){
70 assert(p);
71 struct payment_info *pinfo = &p->payment_info;
72 /* === Public State === */
73 p->status = PAYMENT_PENDING;
74
75 /* I shouldn't be calling a payment_update on a payment that already
76 * succeed */
77 assert(p->preimage == NULL);
78
79 p->error_code = LIGHTNINGD;
80 p->error_msg = tal_free(p->error_msg);
81 p->total_sent = AMOUNT_MSAT(0);
82 p->total_delivering = AMOUNT_MSAT(0);
83 // p->paynotes are unchanged, they accumulate messages
84 p->groupid++;
85
86 /* === Hidden State === */
87 p->exec_state = INVALID_STATE;
88 p->next_partid = 1;
89
90 /* I shouldn't be calling a payment_update on a payment that has pending
91 * cmds. */
92 assert(p->cmd_array);
93 assert(tal_count(p->cmd_array) == 0);
94
95 p->local_gossmods = tal_free(p->local_gossmods);
96 p->have_results = false;
97 p->retry = false;
98 p->waitresult_timer = tal_free(p->waitresult_timer);
99
100 pinfo->start_time = clock_time();
101 pinfo->stop_time =
102 timeabs_add(pinfo->start_time, time_from_sec(pinfo->retryfor));
103
104 return true;
105}
106
107bool payment_set_constraints(
108 struct payment *p,

Callers 1

json_renepayFunction · 0.85

Calls 4

tal_freeFunction · 0.85
clock_timeFunction · 0.85
timeabs_addFunction · 0.85
time_from_secFunction · 0.85

Tested by

no test coverage detected