| 280 | } |
| 281 | |
| 282 | static void handle_splice_feerate_error(struct lightningd *ld, |
| 283 | struct channel *channel, |
| 284 | const u8 *msg) |
| 285 | { |
| 286 | struct splice_command *cc; |
| 287 | struct amount_msat fee; |
| 288 | bool too_high; |
| 289 | char *error_msg; |
| 290 | |
| 291 | if (!fromwire_channeld_splice_feerate_error(msg, &fee, &too_high)) { |
| 292 | channel_internal_error(channel, |
| 293 | "bad fromwire_channeld_splice_feerate_error %s", |
| 294 | tal_hex(channel, msg)); |
| 295 | return; |
| 296 | } |
| 297 | |
| 298 | cc = splice_command_for_chan(ld, channel); |
| 299 | if (cc) { |
| 300 | if (too_high) |
| 301 | error_msg = tal_fmt(tmpctx, "Feerate too high. Do you " |
| 302 | "really want to spend %s on fees?", |
| 303 | fmt_amount_msat(tmpctx, fee)); |
| 304 | else |
| 305 | error_msg = tal_fmt(tmpctx, "Feerate too low. Your " |
| 306 | "funding only provided %s in fees", |
| 307 | fmt_amount_msat(tmpctx, fee)); |
| 308 | |
| 309 | was_pending(command_fail(cc->cmd, |
| 310 | too_high ? SPLICE_HIGH_FEE : SPLICE_LOW_FEE, |
| 311 | "%s", error_msg)); |
| 312 | } |
| 313 | else { |
| 314 | log_peer_unusual(ld->log, &channel->peer->id, "Peer gave us a" |
| 315 | " splice pkg with too low of feerate (fee was" |
| 316 | " %s), we rejected it.", |
| 317 | fmt_amount_msat(tmpctx, fee)); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | static void handle_splice_abort(struct lightningd *ld, |
| 322 | struct channel *channel, |
no test coverage detected