| 919 | } |
| 920 | |
| 921 | void local_enable_chan(struct daemon *daemon, const struct chan *chan, int direction) |
| 922 | { |
| 923 | struct deferred_update *du; |
| 924 | u8 *update = prev_update(tmpctx, daemon, chan, direction); |
| 925 | |
| 926 | |
| 927 | if (!update) |
| 928 | return; |
| 929 | |
| 930 | du = find_deferred_update(daemon, chan); |
| 931 | |
| 932 | /* Will a deferred update enable it? If so, apply immediately. */ |
| 933 | if (du && is_enabled(du->update)) { |
| 934 | apply_deferred_update(du); |
| 935 | return; |
| 936 | } |
| 937 | |
| 938 | /* OK, we definitely don't want deferred update to disable! */ |
| 939 | tal_free(du); |
| 940 | |
| 941 | /* Is it already enabled? */ |
| 942 | if (is_enabled(update)) |
| 943 | return; |
| 944 | |
| 945 | /* Apply this enabling update immediately. */ |
| 946 | set_disable_flag(update, false); |
| 947 | sign_timestamp_and_apply_update(daemon, chan, direction, take(update)); |
| 948 | } |
no test coverage detected