| 652 | } |
| 653 | |
| 654 | static void defer_update(struct daemon *daemon, |
| 655 | u32 delay, |
| 656 | const struct chan *chan, |
| 657 | int direction, |
| 658 | u8 *unsigned_update TAKES) |
| 659 | { |
| 660 | struct deferred_update *du; |
| 661 | |
| 662 | /* Override any existing one */ |
| 663 | tal_free(find_deferred_update(daemon, chan)); |
| 664 | |
| 665 | /* If chan is gone, so are we. */ |
| 666 | du = tal(chan, struct deferred_update); |
| 667 | du->daemon = daemon; |
| 668 | du->chan = chan; |
| 669 | du->direction = direction; |
| 670 | du->update = sign_and_timestamp_update(du, daemon, chan, direction, |
| 671 | unsigned_update); |
| 672 | if (delay != 0xFFFFFFFF) |
| 673 | du->channel_update_timer = new_reltimer(&daemon->timers, du, |
| 674 | time_from_sec(delay), |
| 675 | apply_deferred_update, |
| 676 | du); |
| 677 | else |
| 678 | du->channel_update_timer = NULL; |
| 679 | list_add_tail(&daemon->deferred_updates, &du->list); |
| 680 | tal_add_destructor(du, destroy_deferred_update); |
| 681 | } |
| 682 | |
| 683 | /* If there is a pending update for this local channel, apply immediately. */ |
| 684 | static bool local_channel_update_latest(struct daemon *daemon, struct chan *chan) |
no test coverage detected