| 705 | } |
| 706 | |
| 707 | static void |
| 708 | openchannel_hook_final(struct openchannel_hook_payload *payload STEALS) |
| 709 | { |
| 710 | struct subd *openingd = payload->openingd; |
| 711 | const u8 *our_upfront_shutdown_script = payload->our_upfront_shutdown_script; |
| 712 | const char *errmsg = payload->errmsg; |
| 713 | struct uncommitted_channel* uc = payload->uc; |
| 714 | u32 *upfront_shutdown_script_wallet_index; |
| 715 | |
| 716 | /* We want to free this, whatever happens. */ |
| 717 | tal_steal(tmpctx, payload); |
| 718 | |
| 719 | /* If openingd went away, don't send it anything! */ |
| 720 | if (!openingd) |
| 721 | return; |
| 722 | |
| 723 | tal_del_destructor2(openingd, openchannel_payload_remove_openingd, payload); |
| 724 | |
| 725 | if (!errmsg) { |
| 726 | /* Plugins accepted the offer, cancel any of our |
| 727 | * funder-side commands. */ |
| 728 | opening_funder_failed_cancel_commands(uc, |
| 729 | "Have in-progress " |
| 730 | "`open_channel` from " |
| 731 | "peer"); |
| 732 | uc->got_offer = true; |
| 733 | } |
| 734 | |
| 735 | /* Determine the wallet index for our_upfront_shutdown_script, |
| 736 | * NULL if not found. */ |
| 737 | u32 found_wallet_index; |
| 738 | if (wallet_can_spend(payload->openingd->ld->wallet, |
| 739 | our_upfront_shutdown_script, |
| 740 | tal_bytelen(our_upfront_shutdown_script), |
| 741 | &found_wallet_index, NULL)) { |
| 742 | upfront_shutdown_script_wallet_index = tal(tmpctx, u32); |
| 743 | *upfront_shutdown_script_wallet_index = found_wallet_index; |
| 744 | } else |
| 745 | upfront_shutdown_script_wallet_index = NULL; |
| 746 | |
| 747 | subd_send_msg(openingd, |
| 748 | take(towire_openingd_got_offer_reply(NULL, errmsg, |
| 749 | our_upfront_shutdown_script, |
| 750 | upfront_shutdown_script_wallet_index, |
| 751 | payload->uc->reserve, |
| 752 | payload->uc->minimum_depth))); |
| 753 | } |
| 754 | |
| 755 | static bool |
| 756 | openchannel_hook_deserialize(struct openchannel_hook_payload *payload, |
no test coverage detected