| 1770 | } |
| 1771 | |
| 1772 | static void handle_peer_tx_sigs_sent(struct subd *dualopend, |
| 1773 | const int *fds, |
| 1774 | const u8 *msg) |
| 1775 | { |
| 1776 | struct channel *channel = dualopend->channel; |
| 1777 | struct channel_inflight *inflight; |
| 1778 | const struct wally_tx *wtx; |
| 1779 | |
| 1780 | if (!fromwire_dualopend_tx_sigs_sent(msg)) { |
| 1781 | channel_internal_error(channel, |
| 1782 | "Bad WIRE_DUALOPEND_TX_SIGS_SENT: %s", |
| 1783 | tal_hex(tmpctx, msg)); |
| 1784 | return; |
| 1785 | } |
| 1786 | |
| 1787 | inflight = channel_current_inflight(channel); |
| 1788 | if (!inflight) { |
| 1789 | channel_internal_error(channel, |
| 1790 | "No inflight found for channel"); |
| 1791 | return; |
| 1792 | } |
| 1793 | |
| 1794 | /* Once we've sent our sigs to the peer, we're fine |
| 1795 | * to broadcast the transaction, even if they haven't |
| 1796 | * sent us their tx-sigs yet. They're not allowed to |
| 1797 | * send us funding-locked until their tx-sigs has been |
| 1798 | * received, but that's no reason not to broadcast. |
| 1799 | * Note this only happens if we're the only input-er */ |
| 1800 | if (psbt_finalize(inflight->funding_psbt) && |
| 1801 | !inflight->tx_broadcast) { |
| 1802 | inflight->tx_broadcast = true; |
| 1803 | |
| 1804 | wtx = psbt_final_tx(tmpctx, inflight->funding_psbt); |
| 1805 | if (!wtx) { |
| 1806 | channel_internal_error(channel, |
| 1807 | "Unable to extract final tx" |
| 1808 | " from PSBT %s", |
| 1809 | fmt_wally_psbt(tmpctx, |
| 1810 | inflight->funding_psbt)); |
| 1811 | return; |
| 1812 | } |
| 1813 | |
| 1814 | /* BOLT #2: |
| 1815 | * |
| 1816 | * The receiving node: |
| 1817 | * ... |
| 1818 | * - if the `witness` weight lowers the effective `feerate` |
| 1819 | * below the *opener*'s feerate for the funding transaction |
| 1820 | * and the effective `feerate` is determined by the receiving |
| 1821 | * node to be insufficient for getting the transaction |
| 1822 | * confirmed in a timely manner: |
| 1823 | * - SHOULD broadcast their commitment transaction, closing the channel |
| 1824 | */ |
| 1825 | if (!feerate_satisfied(inflight->funding_psbt, |
| 1826 | inflight->funding->feerate)) { |
| 1827 | char *errmsg = tal_fmt(tmpctx, |
| 1828 | "Witnesses lower effective" |
| 1829 | " feerate below agreed upon rate" |
no test coverage detected