| 425 | } |
| 426 | |
| 427 | static inline u32 minconf_to_maxheight(u32 minconf, struct lightningd *ld) |
| 428 | { |
| 429 | /* No confirmations is special, we need to disable the check in the |
| 430 | * selection */ |
| 431 | if (minconf == 0) |
| 432 | return 0; |
| 433 | |
| 434 | /* Avoid wrapping around and suddenly allowing any confirmed |
| 435 | * outputs. Since we can't have a coinbase output, and 0 is taken for |
| 436 | * the disable case, we can just clamp to 1. */ |
| 437 | if (minconf >= ld->topology->tip->height) |
| 438 | return 1; |
| 439 | return ld->topology->tip->height - minconf + 1; |
| 440 | } |
| 441 | |
| 442 | /* Returns false if it needed to create change, but couldn't afford. */ |
| 443 | static bool change_for_emergency(struct lightningd *ld, |
no outgoing calls
no test coverage detected