| 127 | } |
| 128 | |
| 129 | void channel_config(struct lightningd *ld, |
| 130 | struct channel_config *ours, |
| 131 | u32 *max_to_self_delay, |
| 132 | struct amount_msat *min_effective_htlc_capacity) |
| 133 | { |
| 134 | /* FIXME: depend on feerate. */ |
| 135 | *max_to_self_delay = ld->config.max_htlc_cltv; |
| 136 | |
| 137 | /* Take minimal effective capacity from config min_capacity_sat */ |
| 138 | if (!amount_sat_to_msat(min_effective_htlc_capacity, |
| 139 | amount_sat(ld->config.min_capacity_sat))) |
| 140 | fatal("amount_msat overflow for config.min_capacity_sat"); |
| 141 | |
| 142 | /* BOLT #2: |
| 143 | * |
| 144 | * The sending node SHOULD: |
| 145 | *... |
| 146 | * - set `dust_limit_satoshis` to a sufficient value to allow |
| 147 | * commitment transactions to propagate through the Bitcoin network. |
| 148 | */ |
| 149 | ours->dust_limit = chainparams->dust_limit; |
| 150 | ours->max_htlc_value_in_flight = AMOUNT_MSAT(UINT64_MAX); |
| 151 | |
| 152 | ours->max_dust_htlc_exposure_msat |
| 153 | = ld->config.max_dust_htlc_exposure_msat; |
| 154 | |
| 155 | /* Don't care */ |
| 156 | ours->htlc_minimum = ld->config.htlc_minimum_msat; |
| 157 | |
| 158 | /* BOLT #2: |
| 159 | * |
| 160 | * The sending node SHOULD: |
| 161 | * - set `to_self_delay` sufficient to ensure the sender can |
| 162 | * irreversibly spend a commitment transaction output, in case of |
| 163 | * misbehavior by the receiver. |
| 164 | */ |
| 165 | ours->to_self_delay = ld->config.locktime_blocks; |
| 166 | |
| 167 | ours->max_accepted_htlcs = ld->config.max_concurrent_htlcs; |
| 168 | |
| 169 | /* This is filled in by lightning_openingd, for consistency. */ |
| 170 | ours->channel_reserve = AMOUNT_SAT(UINT64_MAX); |
| 171 | } |
nothing calls this directly
no test coverage detected