| 105 | } |
| 106 | |
| 107 | bool payment_set_constraints( |
| 108 | struct payment *p, |
| 109 | struct amount_msat amount, |
| 110 | struct amount_msat maxfee, |
| 111 | unsigned int maxdelay, |
| 112 | u64 retryfor, |
| 113 | u64 base_fee_penalty_millionths, |
| 114 | u64 prob_cost_factor_millionths, |
| 115 | u64 riskfactor_millionths, |
| 116 | u64 min_prob_success_millionths, |
| 117 | u64 base_prob_success_millionths, |
| 118 | bool use_shadow, |
| 119 | const struct route_exclusion **exclusions) |
| 120 | { |
| 121 | assert(p); |
| 122 | struct payment_info *pinfo = &p->payment_info; |
| 123 | |
| 124 | /* === Payment attempt parameters === */ |
| 125 | pinfo->amount = amount; |
| 126 | if (!amount_msat_add(&pinfo->maxspend, pinfo->amount, maxfee)) |
| 127 | pinfo->maxspend = AMOUNT_MSAT(UINT64_MAX); |
| 128 | pinfo->maxdelay = maxdelay; |
| 129 | |
| 130 | pinfo->retryfor = retryfor; |
| 131 | |
| 132 | /* === Developer options === */ |
| 133 | pinfo->base_fee_penalty = base_fee_penalty_millionths / 1e6; |
| 134 | pinfo->prob_cost_factor = prob_cost_factor_millionths / 1e6; |
| 135 | pinfo->delay_feefactor = riskfactor_millionths / 1e6; |
| 136 | pinfo->min_prob_success = min_prob_success_millionths / 1e6; |
| 137 | pinfo->base_prob_success = base_prob_success_millionths / 1e6; |
| 138 | pinfo->use_shadow = use_shadow; |
| 139 | |
| 140 | assert(p->disabledmap); |
| 141 | disabledmap_reset(p->disabledmap); |
| 142 | |
| 143 | for (size_t i = 0; i < tal_count(exclusions); i++) { |
| 144 | const struct route_exclusion *ex = exclusions[i]; |
| 145 | if (ex->type == EXCLUDE_CHANNEL) |
| 146 | disabledmap_add_channel(p->disabledmap, ex->u.chan_id); |
| 147 | else |
| 148 | disabledmap_add_node(p->disabledmap, ex->u.node_id); |
| 149 | } |
| 150 | |
| 151 | return true; |
| 152 | } |
| 153 | |
| 154 | struct amount_msat payment_sent(const struct payment *p) |
| 155 | { |
no test coverage detected