Sets state values to ongoing payment */
| 67 | |
| 68 | /* Sets state values to ongoing payment */ |
| 69 | bool 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 | |
| 107 | bool payment_set_constraints( |
| 108 | struct payment *p, |
no test coverage detected