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