| 420 | } |
| 421 | |
| 422 | static inline u32 minconf_to_maxheight(u32 minconf, struct lightningd *ld) |
| 423 | { |
| 424 | /* No confirmations is special, we need to disable the check in the |
| 425 | * selection */ |
| 426 | if (minconf == 0) |
| 427 | return 0; |
| 428 | |
| 429 | /* Avoid wrapping around and suddenly allowing any confirmed |
| 430 | * outputs. Since we can't have a coinbase output, and 0 is taken for |
| 431 | * the disable case, we can just clamp to 1. */ |
| 432 | if (minconf >= ld->topology->tip->height) |
| 433 | return 1; |
| 434 | return ld->topology->tip->height - minconf + 1; |
| 435 | } |
| 436 | |
| 437 | static struct command_result *param_reserve_num(struct command *cmd, |
| 438 | const char *name, |